agentic-qe 3.10.8 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/v3/qe-learning-coordinator.md +1 -1
- package/.claude/skills/README.md +2 -2
- package/.claude/skills/agentic-quality-engineering/SKILL.md +6 -5
- package/.claude/skills/agentic-quality-engineering/schemas/output.json +7 -3
- package/.claude/skills/holistic-testing-pact/SKILL.md +50 -17
- package/.claude/skills/skills-manifest.json +6 -6
- package/.opencode/skills/qe-agentic-quality-engineering.yaml +5 -5
- package/.opencode/skills/qe-holistic-testing-pact.yaml +11 -11
- package/CHANGELOG.md +88 -1
- package/README.md +17 -0
- package/assets/agents/v3/qe-learning-coordinator.md +1 -1
- package/assets/skills/README.md +2 -2
- package/assets/skills/agentic-quality-engineering/SKILL.md +6 -5
- package/assets/skills/agentic-quality-engineering/schemas/output.json +7 -3
- package/assets/skills/holistic-testing-pact/SKILL.md +50 -17
- package/assets/skills/skills-manifest.json +6 -6
- package/dist/cli/bundle.js +5 -5
- package/dist/cli/chunks/adapter-WLFT5VMV.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-4JSL6LF6.js → agent-booster-wasm-5CSKQB4O.js} +2 -2
- package/dist/cli/chunks/{agent-handler-6YOFH7KL.js → agent-handler-EBV3OKTE.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-O3IBK4BY.js → agent-memory-branch-RZ53YM2U.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-JBH4GZUM.js +2 -0
- package/dist/cli/chunks/{arena-BLCAZNAY.js → arena-QWYTIQ6I.js} +2 -2
- package/dist/cli/chunks/{arena-KLGRZTTU.js → arena-UCP74DRO.js} +4 -4
- package/dist/cli/chunks/{audit-FKKLR22S.js → audit-M4FNIX47.js} +2 -2
- package/dist/cli/chunks/base-A7JGM473.js +2 -0
- package/dist/cli/chunks/{hnswlib-node-PNPV64M3.js → better-sqlite3-RIBLRHJL.js} +2 -2
- package/dist/cli/chunks/{brain-handler-YTGYC2QW.js → brain-handler-OY6Q2GY5.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-KIIBEJ5S.js → branch-enumerator-TQWN4NIX.js} +2 -2
- package/dist/cli/chunks/{browser-7YZLTV2C.js → browser-2EH3RXJ2.js} +2 -2
- package/dist/cli/chunks/browser-workflow-TIDJWULK.js +2 -0
- package/dist/cli/chunks/{chunk-4IGSL7CX.js → chunk-2BBKA5J4.js} +1 -1
- package/dist/cli/chunks/{chunk-LZVKR7HV.js → chunk-2QU6C3OS.js} +2 -2
- package/dist/cli/chunks/{chunk-B3B5QZYN.js → chunk-2TUVBEWK.js} +2 -2
- package/dist/cli/chunks/{chunk-W72CUJRB.js → chunk-2WVLFT2I.js} +1 -1
- package/dist/cli/chunks/{chunk-JZYXYHEE.js → chunk-2ZC7S4UG.js} +2 -2
- package/dist/cli/chunks/{chunk-PG7KISET.js → chunk-3GWSHRDA.js} +2 -2
- package/dist/cli/chunks/{chunk-VKLPSPPI.js → chunk-3J6LYF6I.js} +2 -2
- package/dist/cli/chunks/{chunk-ZSMHQENA.js → chunk-3LP5GPGU.js} +1 -1
- package/dist/cli/chunks/{chunk-MWAEUJDC.js → chunk-453UDYD2.js} +229 -225
- package/dist/cli/chunks/{chunk-DI7REPYC.js → chunk-4OTA6KYJ.js} +2 -2
- package/dist/cli/chunks/{chunk-SDVL5TZK.js → chunk-5ASPEVVF.js} +1 -1
- package/dist/cli/chunks/{chunk-LCDMB5SP.js → chunk-5DG6H553.js} +1 -1
- package/dist/cli/chunks/{chunk-JFTRHS5V.js → chunk-5OJXVVTI.js} +2 -2
- package/dist/cli/chunks/{chunk-6B3COND2.js → chunk-6VQKNPGY.js} +2 -2
- package/dist/cli/chunks/{chunk-NKKDO5W4.js → chunk-72QNONO6.js} +2 -2
- package/dist/cli/chunks/{chunk-OZDRAKFF.js → chunk-73EWPVBJ.js} +2 -2
- package/dist/cli/chunks/{chunk-CP4CSI5R.js → chunk-7BD7DZCB.js} +2 -2
- package/dist/cli/chunks/{chunk-DNC27OP7.js → chunk-7E5NYLJT.js} +2 -2
- package/dist/cli/chunks/{chunk-CDNXXNQM.js → chunk-7MBF3S25.js} +1 -1
- package/dist/cli/chunks/{chunk-IFQPGBKQ.js → chunk-7PTA7AVW.js} +1 -1
- package/dist/cli/chunks/{chunk-QNNH5TDV.js → chunk-7Q6CMSMD.js} +3 -3
- package/dist/cli/chunks/{chunk-SDGRU6SG.js → chunk-ACV2WVMX.js} +1 -1
- package/dist/cli/chunks/{chunk-XRJH5KXF.js → chunk-AURDGQNB.js} +2 -2
- package/dist/cli/chunks/{chunk-LIOK7WBX.js → chunk-AVKGDS6F.js} +2 -2
- package/dist/cli/chunks/{chunk-DPSLJ6IW.js → chunk-AYOTODUV.js} +1 -1
- package/dist/cli/chunks/{chunk-OK6CSJOX.js → chunk-B4QA3YN6.js} +1 -1
- package/dist/cli/chunks/{chunk-MTWBYHMS.js → chunk-BA4WZIAQ.js} +2 -2
- package/dist/cli/chunks/{chunk-RNJRKFMX.js → chunk-BEOGI5FC.js} +2 -2
- package/dist/cli/chunks/{chunk-XYXRO7VP.js → chunk-C33BMWYZ.js} +2 -2
- package/dist/cli/chunks/chunk-C4OYHUJV.js +2 -0
- package/dist/cli/chunks/{chunk-ON6C2OYG.js → chunk-CERSTEAJ.js} +2 -2
- package/dist/cli/chunks/{chunk-YATW2RWQ.js → chunk-D3S4SRSA.js} +2 -2
- package/dist/cli/chunks/{chunk-CCUUTTTJ.js → chunk-DCJIXDO6.js} +2 -2
- package/dist/cli/chunks/chunk-DDQWW22L.js +6 -0
- package/dist/cli/chunks/{chunk-FWQZZ22V.js → chunk-DV7662EZ.js} +1 -1
- package/dist/cli/chunks/{chunk-HVE3EH36.js → chunk-ETGEGMYS.js} +3 -3
- package/dist/cli/chunks/{chunk-CO6UY7ZU.js → chunk-ETZ62NFD.js} +1 -1
- package/dist/cli/chunks/{chunk-G73PIM7X.js → chunk-F62ZQZQQ.js} +2 -2
- package/dist/cli/chunks/{chunk-AGQIJWAD.js → chunk-F6Y7DTHR.js} +2 -2
- package/dist/cli/chunks/{chunk-LT4OZHMK.js → chunk-FGOVDO3R.js} +2 -2
- package/dist/cli/chunks/{chunk-YUK4KU2B.js → chunk-FMKALHT3.js} +2 -2
- package/dist/cli/chunks/{chunk-X3NEQ3SL.js → chunk-FMULOSBL.js} +1 -1
- package/dist/cli/chunks/{chunk-3AG2MM7U.js → chunk-FTOICJQG.js} +2 -2
- package/dist/cli/chunks/{chunk-YQYTQRTR.js → chunk-G25YZ7Z6.js} +2 -2
- package/dist/cli/chunks/{chunk-QHLENBGB.js → chunk-G5VE3HQW.js} +2 -2
- package/dist/cli/chunks/{chunk-XLQX77KP.js → chunk-GBFAQ4DW.js} +1 -1
- package/dist/cli/chunks/{chunk-Z57UERQZ.js → chunk-GGSXHGWD.js} +2 -2
- package/dist/cli/chunks/{chunk-TXLLF7XR.js → chunk-HHSEIPSQ.js} +1 -1
- package/dist/cli/chunks/{chunk-4G2GTX2V.js → chunk-HJFQVKPI.js} +1 -1
- package/dist/cli/chunks/{chunk-WKLI5Z3L.js → chunk-HMSPPGUF.js} +2 -2
- package/dist/cli/chunks/{chunk-2KP5TJS2.js → chunk-HNSZDIQU.js} +2 -2
- package/dist/cli/chunks/{chunk-77BVW2CT.js → chunk-I2HQLBWG.js} +2 -2
- package/dist/cli/chunks/{chunk-G2J7WGOG.js → chunk-IFTEM672.js} +2 -2
- package/dist/cli/chunks/{chunk-Q7B7T4YK.js → chunk-IHNBZ5XG.js} +2 -2
- package/dist/cli/chunks/{chunk-5GPOSKGP.js → chunk-IKNDGXZZ.js} +2 -2
- package/dist/cli/chunks/{chunk-ALFF4AAM.js → chunk-IOQYSR5S.js} +2 -2
- package/dist/cli/chunks/{chunk-7LHN6WBX.js → chunk-IQSPL2H4.js} +2 -2
- package/dist/cli/chunks/{chunk-E5GUTKET.js → chunk-ISVBO4XO.js} +2 -2
- package/dist/cli/chunks/{chunk-KTBBSOZG.js → chunk-ITRUZ3WE.js} +2 -2
- package/dist/cli/chunks/{chunk-OIU6PKLF.js → chunk-J425SQFE.js} +2 -2
- package/dist/cli/chunks/{chunk-NFZY6ZVY.js → chunk-JN3IQB4L.js} +1 -1
- package/dist/cli/chunks/{chunk-6B32USSC.js → chunk-JNX7IRSI.js} +2 -2
- package/dist/cli/chunks/{chunk-PRYSWF6F.js → chunk-JQM64WJ2.js} +1 -1
- package/dist/cli/chunks/{chunk-4B676LUC.js → chunk-JQSA6EMI.js} +2 -2
- package/dist/cli/chunks/{chunk-NL4EKO2J.js → chunk-JZFA2PWY.js} +2 -2
- package/dist/cli/chunks/{chunk-54PBHRRW.js → chunk-KBVXKFDI.js} +4 -4
- package/dist/cli/chunks/{chunk-Z4WAJ647.js → chunk-KOOY72E3.js} +2 -2
- package/dist/cli/chunks/{chunk-M5PBVK3V.js → chunk-KZE5UR4T.js} +3 -3
- package/dist/cli/chunks/{chunk-2RDWYJJY.js → chunk-L7GQKJLV.js} +2 -2
- package/dist/cli/chunks/{chunk-GXKCRIHK.js → chunk-LCDRRAES.js} +2 -2
- package/dist/cli/chunks/{chunk-VL4MSE3J.js → chunk-LFT7WYHW.js} +2 -2
- package/dist/cli/chunks/{chunk-LBR5FXPD.js → chunk-LTH6XARD.js} +5 -5
- package/dist/cli/chunks/{chunk-KWKGROPS.js → chunk-LYV7WJWA.js} +1 -1
- package/dist/cli/chunks/{chunk-HVFHPDXV.js → chunk-MDYI4IIW.js} +1 -1
- package/dist/cli/chunks/{chunk-KTEWRRDZ.js → chunk-MKLLB4PM.js} +4 -4
- package/dist/cli/chunks/{chunk-34LWJDCM.js → chunk-MTSMFEWK.js} +2 -2
- package/dist/cli/chunks/{chunk-CHPL7TA4.js → chunk-N3R3JGUY.js} +1 -1
- package/dist/cli/chunks/{chunk-HWJEHXPQ.js → chunk-N52ZBTPM.js} +2 -2
- package/dist/cli/chunks/{chunk-X4CHPEOQ.js → chunk-N7MKF4F4.js} +1 -1
- package/dist/cli/chunks/{chunk-H35FNLQJ.js → chunk-NBTKI2TX.js} +2 -2
- package/dist/cli/chunks/{chunk-FPEFIJQ6.js → chunk-NI7O3GKZ.js} +3 -3
- package/dist/cli/chunks/{chunk-2UL4UK6V.js → chunk-NQD4CMXC.js} +2 -2
- package/dist/cli/chunks/{chunk-DNEYBK7X.js → chunk-O6FN53HB.js} +1 -1
- package/dist/cli/chunks/{chunk-XPAH7SEX.js → chunk-OZQIDDXB.js} +2 -2
- package/dist/cli/chunks/{chunk-474ZUVGP.js → chunk-P3NV6KN3.js} +1 -1
- package/dist/cli/chunks/{chunk-JITZAJJN.js → chunk-PC3VIR2A.js} +3 -3
- package/dist/cli/chunks/{chunk-WYAHOUK2.js → chunk-PJ4HSXH3.js} +1 -1
- package/dist/cli/chunks/{chunk-Z7FWPSOK.js → chunk-PUTRXS5I.js} +2 -2
- package/dist/cli/chunks/{chunk-GDHJZPNC.js → chunk-PVBJUANU.js} +2 -2
- package/dist/cli/chunks/{chunk-PTPGYUT2.js → chunk-QCJ7YOVN.js} +2 -2
- package/dist/cli/chunks/{chunk-T2Z3M6HA.js → chunk-QGBXENIP.js} +1 -1
- package/dist/cli/chunks/{chunk-OLOKPY5O.js → chunk-QYXTESM3.js} +2 -2
- package/dist/cli/chunks/{chunk-OV3ESWN4.js → chunk-QZQGYSDG.js} +2 -2
- package/dist/cli/chunks/{chunk-HEC2UWY3.js → chunk-R3YO3Z7I.js} +4 -4
- package/dist/cli/chunks/{chunk-JQBD4JO2.js → chunk-R7FHQQAV.js} +2 -2
- package/dist/cli/chunks/{chunk-MSWBVPVQ.js → chunk-RKDNLPZM.js} +2 -2
- package/dist/cli/chunks/{chunk-BALWMVCX.js → chunk-RPYYS6BX.js} +2 -2
- package/dist/cli/chunks/{chunk-R2LWUBET.js → chunk-RVQW6CBF.js} +2 -2
- package/dist/cli/chunks/{chunk-VM5C4DIV.js → chunk-SHW43QQV.js} +2 -2
- package/dist/cli/chunks/{chunk-S6PGWJDK.js → chunk-SKL225P5.js} +2 -2
- package/dist/cli/chunks/{chunk-Y4XTPEAC.js → chunk-SLWJNHCR.js} +2 -2
- package/dist/cli/chunks/{chunk-XNFYQRJ2.js → chunk-SQPDGRYR.js} +1 -1
- package/dist/cli/chunks/{chunk-NOP5ZJ7E.js → chunk-T6KT63NC.js} +2 -2
- package/dist/cli/chunks/{chunk-C6TUX7YJ.js → chunk-TGLEREP5.js} +2 -2
- package/dist/cli/chunks/{chunk-O75ODKCX.js → chunk-TYS77XHV.js} +2 -2
- package/dist/cli/chunks/{chunk-Q32LITZL.js → chunk-UEH6C5JA.js} +1 -1
- package/dist/cli/chunks/{chunk-6R6RC6YJ.js → chunk-UFMW25MS.js} +2 -2
- package/dist/cli/chunks/{chunk-BMSMDD72.js → chunk-V6WJVFRN.js} +2 -2
- package/dist/cli/chunks/{chunk-GHIHW3IE.js → chunk-VGYUVMSN.js} +2 -2
- package/dist/cli/chunks/{chunk-33CLP2NE.js → chunk-VHON5NDM.js} +3 -3
- package/dist/cli/chunks/{chunk-D7IH2A3C.js → chunk-VVJXQ4FR.js} +2 -2
- package/dist/cli/chunks/{chunk-K5Y64X2U.js → chunk-WBQEOACC.js} +2 -2
- package/dist/cli/chunks/{chunk-NWIKNQLJ.js → chunk-WP6XUSVW.js} +1 -1
- package/dist/cli/chunks/{chunk-FXPAGKVS.js → chunk-X2L4POJE.js} +1 -1
- package/dist/cli/chunks/{chunk-H73AA2JI.js → chunk-X2TUDGFL.js} +18 -18
- package/dist/cli/chunks/{chunk-WDZT344G.js → chunk-XKRG2U3V.js} +15 -13
- package/dist/cli/chunks/{chunk-D7ZVIL3C.js → chunk-XMZ2DHUL.js} +1 -1
- package/dist/cli/chunks/{chunk-LJEO5R32.js → chunk-XSG4XKGO.js} +2 -2
- package/dist/cli/chunks/{chunk-UU422SST.js → chunk-XVQUVCFR.js} +2 -2
- package/dist/cli/chunks/{chunk-SSRMFU4P.js → chunk-XW5OXBVV.js} +2 -2
- package/dist/cli/chunks/{chunk-DDMKCHYT.js → chunk-Y7TBCHW4.js} +2 -2
- package/dist/cli/chunks/{chunk-XKIVOADM.js → chunk-Y7UJC5OL.js} +3 -3
- package/dist/cli/chunks/{chunk-HE3KLHNO.js → chunk-YQIMO7VJ.js} +2 -2
- package/dist/cli/chunks/{chunk-RXWPYY6H.js → chunk-YR44KQUK.js} +1 -1
- package/dist/cli/chunks/{chunk-QHGHWATK.js → chunk-YRP73HO4.js} +1 -1
- package/dist/cli/chunks/{chunk-5KUINS3D.js → chunk-YSTWLDVD.js} +3 -3
- package/dist/cli/chunks/{chunk-YMJ5AVVU.js → chunk-Z45QDDZQ.js} +1 -1
- package/dist/cli/chunks/{chunk-2F4VRCT6.js → chunk-ZEUUVLS2.js} +1 -1
- package/dist/cli/chunks/{chunk-7NKVEEXD.js → chunk-ZFP3O5FM.js} +1 -1
- package/dist/cli/chunks/{chunk-4AG2TQEF.js → chunk-ZK56THZT.js} +3 -3
- package/dist/cli/chunks/{chunk-4OHLPG6B.js → chunk-ZT4NPTML.js} +2 -2
- package/dist/cli/chunks/{ci-2G4BBIQD.js → ci-4JK2NFCD.js} +2 -2
- package/dist/cli/chunks/{ci-output-SI3ME52L.js → ci-output-LCGTJQWC.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-KTICF3EC.js → circuit-breaker-EJF7D3L4.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-F44PULFU.js → claude-flow-setup-3RUC6OB4.js} +2 -2
- package/dist/cli/chunks/client-ZLJ3JMBC.js +2 -0
- package/dist/cli/chunks/cline-installer-6LY5C5QH.js +4 -0
- package/dist/cli/chunks/{code-EDLIBN77.js → code-MPDG4UHS.js} +2 -2
- package/dist/cli/chunks/{code-index-extractor-P4NBWGTV.js → code-index-extractor-OY5GQJBM.js} +2 -2
- package/dist/cli/chunks/codex-installer-BO7E2ZVA.js +8 -0
- package/dist/cli/chunks/{completions-XPCXB5SR.js → completions-VGL3KJ2R.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-LAL5RSB7.js → complexity-analyzer-5DPUK7IL.js} +2 -2
- package/dist/cli/chunks/continuedev-installer-LFDG2D42.js +15 -0
- package/dist/cli/chunks/copilot-installer-SEMMMIZH.js +3 -0
- package/dist/cli/chunks/core-handlers-EM7FUYTI.js +2 -0
- package/dist/cli/chunks/{cost-tracker-EUJFKHGT.js → cost-tracker-OPBC6FQM.js} +2 -2
- package/dist/cli/chunks/{coverage-C75LPZYB.js → coverage-CFDUSRKU.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-DYGHQ6P5.js +2 -0
- package/dist/cli/chunks/cursor-installer-6TXUUVY4.js +3 -0
- package/dist/cli/chunks/{daemon-JR2MSTSK.js → daemon-5KO46YQR.js} +4 -4
- package/dist/cli/chunks/{daemon-BPVBZZQO.js → daemon-7BDBPPAF.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-I5H7DBNU.js → dag-attention-scheduler-6DQKZOUW.js} +2 -2
- package/dist/cli/chunks/{detect-O5TMML24.js → detect-R2QAYDPI.js} +2 -2
- package/dist/cli/chunks/{dist-node-MDZ6UQ3V.js → dist-node-3POCIJ4N.js} +2 -2
- package/dist/cli/chunks/{domain-handler-BGBTZETG.js → domain-handler-KW63CHUH.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-C2D2IEYV.js → domain-transfer-2QPOJCUD.js} +2 -2
- package/dist/cli/chunks/dream-DBE5D5BD.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-UJREBJF5.js → embed-and-insert-pattern-OIDJZQEP.js} +2 -2
- package/dist/cli/chunks/{eval-BDD24HQC.js → eval-UGEKTTAQ.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-KLVXIIYH.js → experience-capture-middleware-3BIM2TT7.js} +3 -3
- package/dist/cli/chunks/{fast-paths-5HIKAQZ7.js → fast-paths-HCJQXB7W.js} +2 -2
- package/dist/cli/chunks/{feature-flags-YE5SJPDS.js → feature-flags-GDGJKLN4.js} +2 -2
- package/dist/cli/chunks/{feature-flags-NM3S7OEW.js → feature-flags-W4JSFBMV.js} +2 -2
- package/dist/cli/chunks/{file-discovery-PWRQZNJQ.js → file-discovery-JMUZ4MUH.js} +2 -2
- package/dist/cli/chunks/{fleet-UIPKNQX3.js → fleet-YNNK2CKW.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-GWGKZRTO.js → gnn-wrapper-R2ZY6CDD.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-GQHJPNAY.js → heartbeat-handler-OZX2EJHQ.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-NFHAANNL.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-HMPCZFBY.js +2 -0
- package/dist/cli/chunks/hnsw-index-KRIWSXX4.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-NE5JIRG3.js → hnsw-legacy-bridge-3S6TYCG3.js} +2 -2
- package/dist/cli/chunks/{better-sqlite3-MROES2Y7.js → hnswlib-node-HMZC5TXM.js} +2 -2
- package/dist/cli/chunks/{hooks-3NBBUOB6.js → hooks-KM7WR35T.js} +10 -10
- package/dist/cli/chunks/hybrid-router-BAB32B2W.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-6NRFVDV7.js → hypergraph-engine-RX53A73M.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-F3OOGTXF.js → hypergraph-handler-3QQB3H3Z.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-3D6XHWQE.js +2 -0
- package/dist/cli/chunks/{init-handler-DOTXTVUI.js → init-handler-Y62RH4ZI.js} +22 -21
- package/dist/cli/chunks/init-wizard-LLU3WVGC.js +2 -0
- package/dist/cli/chunks/kernel-ZFHAYHHJ.js +2 -0
- package/dist/cli/chunks/kilocode-installer-26R253L2.js +4 -0
- package/dist/cli/chunks/{kiro-installer-WBJDXY7Q.js → kiro-installer-PFA5QPZZ.js} +4 -4
- package/dist/cli/chunks/knowledge-graph-ETZ65KOY.js +2 -0
- package/dist/cli/chunks/{learning-BC5N4V3D.js → learning-CQLM5ANX.js} +3 -3
- package/dist/cli/chunks/{llm-router-T427WD6R.js → llm-router-QZ5PG4PF.js} +4 -4
- package/dist/cli/chunks/llm-router-service-R6CTGF5I.js +2 -0
- package/dist/cli/chunks/{load-M6SL2O3M.js → load-UPA6LPHM.js} +2 -2
- package/dist/cli/chunks/load-test-UOWIJUCH.js +2 -0
- package/dist/cli/chunks/mcp-LSWTLAJ4.js +2 -0
- package/dist/cli/chunks/{memory-FJAO3CSF.js → memory-VGEYYGCG.js} +5 -5
- package/dist/cli/chunks/memory-backend-E3ZQKW7A.js +2 -0
- package/dist/cli/chunks/{memory-handlers-S3W6IQJL.js → memory-handlers-QBURG7NA.js} +2 -2
- package/dist/cli/chunks/{multi-model-executor-FYOVZ4OH.js → multi-model-executor-VZVFBIKC.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-APSBE4UR.js → opencode-installer-PBQAXNLV.js} +2 -2
- package/dist/cli/chunks/{orchestrator-LN53EQ45.js → orchestrator-YND7JB5O.js} +16 -16
- package/dist/cli/chunks/pattern-null-store-OUOJO2RH.js +2 -0
- package/dist/cli/chunks/{pipeline-BYWXY2NO.js → pipeline-GM5RRUES.js} +2 -2
- package/dist/cli/chunks/{platform-CZ774YPS.js → platform-L7OGGRSL.js} +2 -2
- package/dist/cli/chunks/{plugin-72NXRX5Z.js → plugin-N4YAE6H5.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-G4DE6YKJ.js → prime-radiant-advanced-wasm-7D67XV6Z.js} +2 -2
- package/dist/cli/chunks/protocol-executor-KHAPG5CP.js +2 -0
- package/dist/cli/chunks/{protocol-handler-UH6CV63V.js → protocol-handler-V2WTFU7N.js} +2 -2
- package/dist/cli/chunks/{prove-V7FAT5HF.js → prove-33DS5Z3N.js} +2 -2
- package/dist/cli/chunks/provider-manager-FGPPW7T4.js +2 -0
- package/dist/cli/chunks/qe-reasoning-bank-TS7XOJDA.js +2 -0
- package/dist/cli/chunks/{quality-N2K62FQM.js → quality-WCSEA5GH.js} +2 -2
- package/dist/cli/chunks/queen-coordinator-J35FNFQ3.js +2 -0
- package/dist/cli/chunks/{real-embeddings-TKHUE2RL.js → real-embeddings-OQ5F37DG.js} +2 -2
- package/dist/cli/chunks/roocode-installer-II7LIR2X.js +4 -0
- package/dist/cli/chunks/router-AFTKPDI5.js +2 -0
- package/dist/cli/chunks/routing-feedback-SABZUJTF.js +2 -0
- package/dist/cli/chunks/{routing-handler-UUWD4IKG.js → routing-handler-6OFHARIY.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-B4WPTGCI.js → ruvector-commands-GD5JTR4M.js} +2 -2
- package/dist/cli/chunks/{rvf-dual-writer-MNRJGNIX.js → rvf-dual-writer-HSK6BYZV.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-adapter-P2RDBFA4.js → rvf-migration-adapter-554SMF5S.js} +2 -2
- package/dist/cli/chunks/{rvf-migration-coordinator-DFESZQSS.js → rvf-migration-coordinator-OFDBCAYE.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-57MDDSFQ.js +2 -0
- package/dist/cli/chunks/safe-db-2HR6MVYM.js +2 -0
- package/dist/cli/chunks/schedule-KLVAN6XI.js +2 -0
- package/dist/cli/chunks/scheduler-WYZ6BC5Y.js +2 -0
- package/dist/cli/chunks/{security-MHLTNKFX.js → security-GN4J6DSS.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-LR7E2EQI.js → shared-rvf-adapter-Q4PM3QCN.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-RFFON2F3.js → shared-rvf-dual-writer-R5WK5BXQ.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-2CGU5INO.js +2 -0
- package/dist/cli/chunks/{status-handler-ROPTYGQC.js → status-handler-AHS5WVMG.js} +2 -2
- package/dist/cli/chunks/{structural-health-YGUFXGJ6.js → structural-health-5KUKNLHZ.js} +2 -2
- package/dist/cli/chunks/{sync-6JTRTDL3.js → sync-PUMM3SR6.js} +2 -2
- package/dist/cli/chunks/{sync-NZZUMTKC.js → sync-TQLGD5HX.js} +2 -2
- package/dist/cli/chunks/{task-handler-KYMV3AC6.js → task-handler-D7VXV4AF.js} +2 -2
- package/dist/cli/chunks/{task-handlers-Z63YBQVU.js → task-handlers-QMN4SWUG.js} +3 -3
- package/dist/cli/chunks/{test-O6BQ7FGP.js → test-HEWZR6YQ.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-T3IOXEFI.js → test-scheduling-VTMLBEPA.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-CTI2ULJF.js → token-bootstrap-IYBG7PQ6.js} +2 -2
- package/dist/cli/chunks/{token-usage-TNQTNAVT.js → token-usage-C7H27BFZ.js} +2 -2
- package/dist/cli/chunks/{transformers-CJQDNQER.js → transformers-5ZJVC6NB.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-RBZWLEVQ.js → tree-sitter-wasm-parser-EARBJG2H.js} +2 -2
- package/dist/cli/chunks/{types-OMFCO364.js → types-3IHE42PZ.js} +2 -2
- package/dist/cli/chunks/unified-memory-PMYRQC5K.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-7TRL2K5Q.js +2 -0
- package/dist/cli/chunks/unified-persistence-S4BNJK4S.js +2 -0
- package/dist/cli/chunks/{upgrade-KRVOYWN3.js → upgrade-YP3VFSXO.js} +2 -2
- package/dist/cli/chunks/{validate-32FKHMKQ.js → validate-VSBNKPN6.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-45RPBPPH.js → validate-swarm-GOCJVWXE.js} +2 -2
- package/dist/cli/chunks/{vibium-LCTNDCKK.js → vibium-U6YKCLDF.js} +2 -2
- package/dist/cli/chunks/visual-security-RPMZ3J7L.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-FX2EFCLH.js → web-tree-sitter-TSNVGWSN.js} +2 -2
- package/dist/cli/chunks/windsurf-installer-2VKMEFSD.js +7 -0
- package/dist/cli/chunks/witness-chain-BTDZSQ6P.js +2 -0
- package/dist/cli/chunks/{witness-chain-YG2UWTYZ.js → witness-chain-BWZCW52H.js} +2 -2
- package/dist/cli/chunks/{workflow-AEJ37RNV.js → workflow-J6SCYLU3.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-42B62D3V.js +2 -0
- package/dist/cli/chunks/{wrappers-GSU6VNU6.js → wrappers-M5C7DONW.js} +2 -2
- package/dist/cli/commands/mcp.js +28 -28
- package/dist/cli/handlers/init-handler.d.ts +2 -0
- package/dist/cli/handlers/init-handler.js +22 -1
- package/dist/domains/test-generation/coordinator.d.ts +24 -1
- package/dist/domains/test-generation/coordinator.js +137 -2
- package/dist/domains/test-generation/plugin.js +23 -1
- package/dist/init/cline-installer.d.ts +6 -0
- package/dist/init/cline-installer.js +3 -1
- package/dist/init/codex-installer.d.ts +6 -0
- package/dist/init/codex-installer.js +3 -1
- package/dist/init/continuedev-installer.d.ts +6 -0
- package/dist/init/continuedev-installer.js +10 -3
- package/dist/init/copilot-installer.d.ts +6 -0
- package/dist/init/copilot-installer.js +3 -1
- package/dist/init/cursor-installer.d.ts +6 -0
- package/dist/init/cursor-installer.js +3 -1
- package/dist/init/kilocode-installer.d.ts +6 -0
- package/dist/init/kilocode-installer.js +3 -1
- package/dist/init/kiro-installer.d.ts +5 -0
- package/dist/init/kiro-installer.js +4 -4
- package/dist/init/orchestrator.js +1 -0
- package/dist/init/phases/07-hooks.js +5 -0
- package/dist/init/phases/08-mcp.js +34 -7
- package/dist/init/phases/09-assets.js +30 -27
- package/dist/init/phases/11-claude-md.d.ts +1 -0
- package/dist/init/phases/11-claude-md.js +8 -0
- package/dist/init/phases/13-governance.js +5 -0
- package/dist/init/phases/phase-interface.d.ts +8 -0
- package/dist/init/platform-config-generator.d.ts +3 -1
- package/dist/init/platform-config-generator.js +31 -17
- package/dist/init/roocode-installer.d.ts +6 -0
- package/dist/init/roocode-installer.js +3 -1
- package/dist/init/windsurf-installer.d.ts +6 -0
- package/dist/init/windsurf-installer.js +3 -1
- package/dist/integrations/darwin/index.d.ts +10 -0
- package/dist/integrations/darwin/index.js +2 -0
- package/dist/integrations/darwin/qe-fitness.d.ts +83 -0
- package/dist/integrations/darwin/qe-fitness.js +147 -0
- package/dist/integrations/darwin/types.d.ts +62 -0
- package/dist/integrations/darwin/types.js +14 -0
- package/dist/mcp/bundle.js +376 -371
- package/dist/mcp/entry.js +10 -1
- package/dist/mcp/protocol-server.js +17 -0
- package/dist/optimization/session-cache.d.ts +11 -0
- package/dist/optimization/session-cache.js +31 -0
- package/dist/routing/escalation/auto-escalation-tracker.d.ts +34 -15
- package/dist/routing/escalation/auto-escalation-tracker.js +24 -15
- package/dist/routing/free-tier/executor.d.ts +119 -0
- package/dist/routing/free-tier/executor.js +139 -0
- package/dist/routing/free-tier/feedback-sink.d.ts +49 -0
- package/dist/routing/free-tier/feedback-sink.js +52 -0
- package/dist/routing/free-tier/index.d.ts +14 -0
- package/dist/routing/free-tier/index.js +5 -0
- package/dist/routing/free-tier/ladder.d.ts +41 -0
- package/dist/routing/free-tier/ladder.js +78 -0
- package/dist/routing/free-tier/provider.d.ts +57 -0
- package/dist/routing/free-tier/provider.js +111 -0
- package/dist/routing/free-tier/types.d.ts +80 -0
- package/dist/routing/free-tier/types.js +16 -0
- package/package.json +6 -2
- package/dist/cli/chunks/adapter-PAMPC2X7.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-DGKLEC6I.js +0 -2
- package/dist/cli/chunks/base-6HJR4VJT.js +0 -2
- package/dist/cli/chunks/browser-workflow-OWNU5XK7.js +0 -2
- package/dist/cli/chunks/chunk-2B2RLPK3.js +0 -2
- package/dist/cli/chunks/chunk-NSI3WL6P.js +0 -6
- package/dist/cli/chunks/client-E6GK5NWT.js +0 -2
- package/dist/cli/chunks/cline-installer-A7G7OXIS.js +0 -4
- package/dist/cli/chunks/codex-installer-JB3ULDQP.js +0 -8
- package/dist/cli/chunks/continuedev-installer-GSYBLQV7.js +0 -14
- package/dist/cli/chunks/copilot-installer-7B56CNU2.js +0 -3
- package/dist/cli/chunks/core-handlers-HJUORTFU.js +0 -2
- package/dist/cli/chunks/cross-domain-router-35WVZFAZ.js +0 -2
- package/dist/cli/chunks/cursor-installer-WXQFM4KJ.js +0 -3
- package/dist/cli/chunks/dream-QTZDMP6D.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-N433NZCG.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-MR6W2OA4.js +0 -2
- package/dist/cli/chunks/hnsw-index-XC6EMJA2.js +0 -2
- package/dist/cli/chunks/hybrid-router-SH4IEAJA.js +0 -2
- package/dist/cli/chunks/impact-analyzer-RUTVXE7P.js +0 -2
- package/dist/cli/chunks/init-wizard-56NY5BSP.js +0 -2
- package/dist/cli/chunks/kernel-7JAN7WCO.js +0 -2
- package/dist/cli/chunks/kilocode-installer-3AXYSZTO.js +0 -4
- package/dist/cli/chunks/knowledge-graph-ST4LW3V4.js +0 -2
- package/dist/cli/chunks/llm-router-service-JNDF5MVJ.js +0 -2
- package/dist/cli/chunks/load-test-I3P3DUS5.js +0 -2
- package/dist/cli/chunks/mcp-F2V3KKG6.js +0 -2
- package/dist/cli/chunks/memory-backend-27BBT57O.js +0 -2
- package/dist/cli/chunks/pattern-null-store-SRBYJRNX.js +0 -2
- package/dist/cli/chunks/protocol-executor-WJLJHWO2.js +0 -2
- package/dist/cli/chunks/provider-manager-UKUHSHAL.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-IMUECSFZ.js +0 -2
- package/dist/cli/chunks/queen-coordinator-EC4SVNMB.js +0 -2
- package/dist/cli/chunks/roocode-installer-DFUA6FXW.js +0 -4
- package/dist/cli/chunks/router-TVTOUQLL.js +0 -2
- package/dist/cli/chunks/routing-feedback-Y4WDXNXW.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-4YSC6QKO.js +0 -2
- package/dist/cli/chunks/safe-db-RGAY54O5.js +0 -2
- package/dist/cli/chunks/schedule-KJ4GWLPJ.js +0 -2
- package/dist/cli/chunks/scheduler-AONSLVA3.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-7RZUEPM4.js +0 -2
- package/dist/cli/chunks/unified-memory-G3BYQ3WU.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-F7XUZMKW.js +0 -2
- package/dist/cli/chunks/unified-persistence-V35NXJSO.js +0 -2
- package/dist/cli/chunks/visual-security-K47U7KUM.js +0 -2
- package/dist/cli/chunks/windsurf-installer-I3TSJCNL.js +0 -7
- package/dist/cli/chunks/witness-chain-G6GJXZD3.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-SKF7GC5X.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
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.11.0");process.exit(0)}
|
|
2
2
|
var N="ffffffff-ffff-ffff-ffff-ffffffffffff";var _="00000000-0000-0000-0000-000000000000";var y=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function k(r){return typeof r=="string"&&y.test(r)}var u=k;function q(r){if(!u(r))throw TypeError("Invalid UUID");let n;return Uint8Array.of((n=parseInt(r.slice(0,8),16))>>>24,n>>>16&255,n>>>8&255,n&255,(n=parseInt(r.slice(9,13),16))>>>8,n&255,(n=parseInt(r.slice(14,18),16))>>>8,n&255,(n=parseInt(r.slice(19,23),16))>>>8,n&255,(n=parseInt(r.slice(24,36),16))/1099511627776&255,n/4294967296&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255)}var c=q;var x=[];for(let r=0;r<256;++r)x.push((r+256).toString(16).slice(1));function l(r,n=0){return(x[r[n+0]]+x[r[n+1]]+x[r[n+2]]+x[r[n+3]]+"-"+x[r[n+4]]+x[r[n+5]]+"-"+x[r[n+6]]+x[r[n+7]]+"-"+x[r[n+8]]+x[r[n+9]]+"-"+x[r[n+10]]+x[r[n+11]]+x[r[n+12]]+x[r[n+13]]+x[r[n+14]]+x[r[n+15]]).toLowerCase()}function C(r,n=0){let f=l(r,n);if(!u(f))throw TypeError("Stringified UUID is invalid");return f}var H=C;var v=new Uint8Array(16);function m(){return crypto.getRandomValues(v)}var g={};function X(r,n,f){let e,o=r?._v6??!1;if(r){let t=Object.keys(r);t.length===1&&t[0]==="_v6"&&(r=void 0)}if(r)e=E(r.random??r.rng?.()??m(),r.msecs,r.nsecs,r.clockseq,r.node,n,f);else{let t=Date.now(),i=m();j(g,t,i),e=E(i,g.msecs,g.nsecs,o?void 0:g.clockseq,o?void 0:g.node,n,f)}return n??l(e)}function j(r,n,f){return r.msecs??=-1/0,r.nsecs??=0,n===r.msecs?(r.nsecs++,r.nsecs>=1e4&&(r.node=void 0,r.nsecs=0)):n>r.msecs?r.nsecs=0:n<r.msecs&&(r.node=void 0),r.node||(r.node=f.slice(10,16),r.node[0]|=1,r.clockseq=(f[8]<<8|f[9])&16383),r.msecs=n,r}function E(r,n,f,e,o,t,i=0){if(r.length<16)throw new Error("Random bytes length must be >= 16");if(!t)t=new Uint8Array(16),i=0;else if(i<0||i+16>t.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);n??=Date.now(),f??=0,e??=(r[8]<<8|r[9])&16383,o??=r.slice(10,16),n+=122192928e5;let d=((n&268435455)*1e4+f)%4294967296;t[i++]=d>>>24&255,t[i++]=d>>>16&255,t[i++]=d>>>8&255,t[i++]=d&255;let a=n/4294967296*1e4&268435455;t[i++]=a>>>8&255,t[i++]=a&255,t[i++]=a>>>24&15|16,t[i++]=a>>>16&255,t[i++]=e>>>8|128,t[i++]=e&255;for(let p=0;p<6;++p)t[i++]=o[p];return t}var D=X;function U(r){let n=typeof r=="string"?c(r):r,f=G(n);return typeof r=="string"?l(f):f}function G(r){return Uint8Array.of((r[6]&15)<<4|r[7]>>4&15,(r[7]&15)<<4|(r[4]&240)>>4,(r[4]&15)<<4|(r[5]&240)>>4,(r[5]&15)<<4|(r[0]&240)>>4,(r[0]&15)<<4|(r[1]&240)>>4,(r[1]&15)<<4|(r[2]&240)>>4,96|r[2]&15,r[3],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}import{createHash as K}from"node:crypto";function M(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),K("md5").update(r).digest()}var T=M;function O(r){r=unescape(encodeURIComponent(r));let n=new Uint8Array(r.length);for(let f=0;f<r.length;++f)n[f]=r.charCodeAt(f);return n}var w="6ba7b810-9dad-11d1-80b4-00c04fd430c8",I="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function h(r,n,f,e,o,t){let i=typeof f=="string"?O(f):f,d=typeof e=="string"?c(e):e;if(typeof e=="string"&&(e=c(e)),e?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let a=new Uint8Array(16+i.length);if(a.set(d),a.set(i,d.length),a=n(a),a[6]=a[6]&15|r,a[8]=a[8]&63|128,o){if(t??=0,t<0||t+16>o.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let p=0;p<16;++p)o[t+p]=a[p];return o}return l(a)}function S(r,n,f,e){return h(48,T,r,n,f,e)}S.DNS=w;S.URL=I;var z=S;function F(r,n,f){return!n&&!r&&crypto.randomUUID?crypto.randomUUID():J(r,n,f)}function J(r,n,f){r=r||{};let e=r.random??r.rng?.()??m();if(e.length<16)throw new Error("Random bytes length must be >= 16");if(e[6]=e[6]&15|64,e[8]=e[8]&63|128,n){if(f=f||0,f<0||f+16>n.length)throw new RangeError(`UUID byte range ${f}:${f+15} is out of buffer bounds`);for(let o=0;o<16;++o)n[f+o]=e[o];return n}return l(e)}var P=F;import{createHash as Q}from"node:crypto";function W(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),Q("sha1").update(r).digest()}var V=W;function R(r,n,f,e){return h(80,V,r,n,f,e)}R.DNS=w;R.URL=I;var Y=R;function Z(r,n,f){r??={},f??=0;let e=D({...r,_v6:!0},new Uint8Array(16));if(e=U(e),n){if(f<0||f+16>n.length)throw new RangeError(`UUID byte range ${f}:${f+15} is out of buffer bounds`);for(let o=0;o<16;o++)n[f+o]=e[o];return n}return l(e)}var s=Z;function $(r){let n=typeof r=="string"?c(r):r,f=b(n);return typeof r=="string"?l(f):f}function b(r){return Uint8Array.of((r[3]&15)<<4|r[4]>>4&15,(r[4]&15)<<4|(r[5]&240)>>4,(r[5]&15)<<4|r[6]&15,r[7],(r[1]&15)<<4|(r[2]&240)>>4,(r[2]&15)<<4|(r[3]&240)>>4,16|(r[0]&240)>>4,(r[0]&15)<<4|(r[1]&240)>>4,r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}var A={};function B(r,n,f){let e;if(r)e=L(r.random??r.rng?.()??m(),r.msecs,r.seq,n,f);else{let o=Date.now(),t=m();r0(A,o,t),e=L(t,A.msecs,A.seq,n,f)}return n??l(e)}function r0(r,n,f){return r.msecs??=-1/0,r.seq??=0,n>r.msecs?(r.seq=f[6]<<23|f[7]<<16|f[8]<<8|f[9],r.msecs=n):(r.seq=r.seq+1|0,r.seq===0&&r.msecs++),r}function L(r,n,f,e,o=0){if(r.length<16)throw new Error("Random bytes length must be >= 16");if(!e)e=new Uint8Array(16),o=0;else if(o<0||o+16>e.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return n??=Date.now(),f??=r[6]*127<<24|r[7]<<16|r[8]<<8|r[9],e[o++]=n/1099511627776&255,e[o++]=n/4294967296&255,e[o++]=n/16777216&255,e[o++]=n/65536&255,e[o++]=n/256&255,e[o++]=n&255,e[o++]=112|f>>>28&15,e[o++]=f>>>20&255,e[o++]=128|f>>>14&63,e[o++]=f>>>6&255,e[o++]=f<<2&255|r[10]&3,e[o++]=r[11],e[o++]=r[12],e[o++]=r[13],e[o++]=r[14],e[o++]=r[15],e}var n0=B;function f0(r){if(!u(r))throw TypeError("Invalid UUID");return parseInt(r.slice(14,15),16)}var e0=f0;export{N as a,_ as b,u as c,c as d,H as e,D as f,U as g,z as h,P as i,Y as j,s as k,$ as l,n0 as m,e0 as n};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{k as p}from"./chunk-
|
|
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.11.0");process.exit(0)}
|
|
2
|
+
import{k as p}from"./chunk-D3S4SRSA.js";import{a as f,c as R}from"./chunk-BA4WZIAQ.js";R();var u=class extends p{config={name:"qe/workflows/browser-load",description:"Load, validate, and prepare browser automation workflows from inline YAML or built-in templates. Returns the resolved workflow with steps and variable bindings, ready for browser execution. Templates: login-flow, form-validation, visual-regression, oauth-flow, etc.",domain:"test-execution",schema:this.buildSchema()};buildSchema(){return{type:"object",properties:{workflowYaml:{type:"string",description:"Inline YAML workflow definition. Mutually exclusive with templateName."},templateName:{type:"string",description:"Built-in template name to load.",enum:["login-flow","oauth-flow","scraping-workflow","visual-regression","form-validation","navigation-flow","api-integration","performance-audit","accessibility-audit"]},variables:{type:"object",description:'Runtime variable overrides (e.g., { "baseUrl": "https://example.com" })'}}}}async execute(r,C){try{let{WorkflowLoader:n,WORKFLOW_TEMPLATES:g,WORKFLOW_DESCRIPTIONS:v,interpolateVariables:b}=await import("./browser-2EH3RXJ2.js"),{parse:k}=await import("yaml"),d=new n,l=[...g],y=v;if(!r.workflowYaml&&!r.templateName)return{success:!0,data:{workflowName:"none",description:"No workflow specified. Use templateName or workflowYaml.",source:"none",templateUsed:null,steps:[],variables:{defined:[],provided:{}},validation:{valid:!0,errors:[],warnings:[]},availableTemplates:l,summary:`Available templates: ${l.join(", ")}`}};let e,i,t=null;r.workflowYaml?(i="inline-yaml",e=k(r.workflowYaml)):(i="template",t=r.templateName,e=await d.load(r.templateName));let a=await d.validate(e),w=(e.steps??[]).map(o=>{let s=o.config;if(r.variables){let c={};for(let[h,m]of Object.entries(s))c[h]=typeof m=="string"?b(m,r.variables):m;s=c}return{name:o.name,action:o.action,config:s,optional:o.optional??!1,assertionCount:o.assertions?.length??0}});return{success:!0,data:{workflowName:e.name||t||"custom",description:e.description||t&&y[t]||"",source:i,templateUsed:t,steps:w,variables:{defined:(e.variables??[]).map(o=>({name:o.name,type:o.type,required:o.required,hasDefault:o.default!==void 0})),provided:r.variables||{}},validation:{valid:a.valid,errors:a.errors,warnings:a.warnings},availableTemplates:l,summary:a.valid?`Workflow "${e.name}" loaded (${i}): ${w.length} steps, ${(e.variables??[]).length} variables`:`Workflow "${e.name}" has validation errors: ${a.errors.join("; ")}`}}}catch(n){return{success:!1,error:f(n)}}}};export{u as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
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.11.0");process.exit(0)}
|
|
2
2
|
var P="quality-daemon",x=class{constructor(e){this.backend=e}backend;async get(e){return this.backend.kvGet(e,P)}async set(e,t){await this.backend.kvSet(e,t,P)}async search(e){return this.backend.kvSearch(e,P)}};import{cpus as Z,freemem as ee,totalmem as te,loadavg as ie}from"os";var g=class{queues={now:[],next:[],later:[]};_maxSize;constructor(e=1e3){this._maxSize=e}enqueue(e){return this.size>=this._maxSize?!1:(this.queues[e.priority].push(e),!0)}dequeue(){let e=Date.now();for(let t of["now","next","later"]){let i=this.queues[t];for(;i.length>0;){let o=i.shift();if(!(o.ttlMs&&e-o.createdAt>o.ttlMs))return o}}}peek(){let e=Date.now();for(let t of["now","next","later"]){let i=this.queues[t];for(let o of i)if(!o.ttlMs||e-o.createdAt<=o.ttlMs)return o}}drainPriority(e){let t=this.queues[e].splice(0),i=Date.now();return t.filter(o=>!o.ttlMs||i-o.createdAt<=o.ttlMs)}pruneExpired(){let e=0,t=Date.now();for(let i of["now","next","later"]){let o=this.queues[i].length;this.queues[i]=this.queues[i].filter(r=>!r.ttlMs||t-r.createdAt<=r.ttlMs),e+=o-this.queues[i].length}return e}get size(){return this.queues.now.length+this.queues.next.length+this.queues.later.length}get depths(){return{now:this.queues.now.length,next:this.queues.next.length,later:this.queues.later.length}}get isEmpty(){return this.size===0}clear(){this.queues.now=[],this.queues.next=[],this.queues.later=[]}};import{watch as G}from"fs";import{execFile as Q}from"child_process";import{promisify as $}from"util";import{resolve as q,join as H}from"path";import{existsSync as L,readFileSync as U}from"fs";var _=$(Q),z={repoRoot:process.cwd(),debounceMs:500,maxChangedFiles:200,pollIntervalMs:5e3},p=class{constructor(e,t){this.queue=e;this.options={...z,...t}}queue;watcher;pollTimer;options;lastKnownHeads=new Map;debounceTimer;_running=!1;_polling=!1;get running(){return this._running}async start(){if(this._running)return;let e=q(this.options.repoRoot,".git","refs","heads");if(!L(e))throw new Error(`Git refs directory not found: ${e}`);await this.snapshotHeads(),process.platform==="darwin"||process.platform==="win32"?this.watcher=G(e,{recursive:!0},(i,o)=>{o&&this.handleRefChange(o)}):(this.pollTimer=setInterval(()=>{this.poll().catch(i=>{console.debug("[GitWatcher] Poll error:",i)})},this.options.pollIntervalMs),this.pollTimer.unref?.()),this._running=!0}stop(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=void 0),this.watcher&&(this.watcher.close(),this.watcher=void 0),this._running=!1}async poll(){if(this._polling)return[];this._polling=!0;let e=[];try{let{stdout:t}=await _("git",["for-each-ref","--format=%(refname:short) %(objectname:short)","refs/heads/"],{cwd:this.options.repoRoot});for(let i of t.trim().split(`
|
|
3
3
|
`)){if(!i)continue;let[o,r]=i.split(" "),n=this.lastKnownHeads.get(o);n&&n!==r&&(e.push(o),await this.enqueueCommitAnalysis(o,r)),this.lastKnownHeads.set(o,r)}}catch{}finally{this._polling=!1}return e}handleRefChange(e){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.processRefChange(e).catch(t=>{console.debug("[GitWatcher] Error processing ref change:",t)})},this.options.debounceMs)}async processRefChange(e){let t=e.replace(/\\/g,"/"),i=q(this.options.repoRoot,".git","refs","heads"),o=H(i,e),r;try{r=U(o,"utf-8").trim()}catch{return}this.lastKnownHeads.get(t)!==r&&(this.lastKnownHeads.set(t,r),await this.enqueueCommitAnalysis(t,r))}async enqueueCommitAnalysis(e,t){let i=[];try{let{stdout:n}=await _("git",["diff-tree","--no-commit-id","--name-only","-r",t],{cwd:this.options.repoRoot});i=n.trim().split(`
|
|
4
4
|
`).filter(Boolean).slice(0,this.options.maxChangedFiles)}catch{}let o={type:"git_commit",branch:e,commitHash:t,changedFiles:i},r={id:`git-${t}-${Date.now()}`,priority:"next",payload:o,createdAt:Date.now(),source:"git-watcher",ttlMs:300*1e3};this.queue.enqueue(r)}async snapshotHeads(){try{let{stdout:e}=await _("git",["for-each-ref","--format=%(refname:short) %(objectname:short)","refs/heads/"],{cwd:this.options.repoRoot});for(let t of e.trim().split(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{i as c}from"./chunk-
|
|
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.11.0");process.exit(0)}
|
|
2
|
+
import{i as c}from"./chunk-MDYI4IIW.js";import{a as p}from"./chunk-C4OYHUJV.js";import{c as m}from"./chunk-F62ZQZQQ.js";import{b as g,d as E}from"./chunk-Y7TBCHW4.js";import{a as l,b as _}from"./chunk-ZT4NPTML.js";_();import b from"node:path";import{existsSync as h}from"node:fs";E();p();var T=m.create("metrics-tracker"),d=class{db=null;dbPath;initialized=!1;constructor(e=process.cwd()){this.dbPath=b.join(e,".agentic-qe","memory.db")}async initialize(){if(!this.initialized){if(!h(this.dbPath))throw new Error(`Database not found: ${this.dbPath}. Run "aqe init --auto" first.`);this.db=l(this.dbPath),this.ensureMetricsTable(),this.initialized=!0}}ensureMetricsTable(){this.db&&this.db.exec(`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS learning_daily_snapshots (
|
|
4
4
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
5
5
|
snapshot_date TEXT NOT NULL UNIQUE,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{c as N,g as O,i as L}from"./chunk-
|
|
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.11.0");process.exit(0)}
|
|
2
|
+
import{c as N,g as O,i as L}from"./chunk-7Q6CMSMD.js";import{i as R,m as D}from"./chunk-QYXTESM3.js";import{b as g,d as w}from"./chunk-Y7TBCHW4.js";import{a as p,c as q}from"./chunk-BA4WZIAQ.js";import{i as h}from"./chunk-JN3IQB4L.js";import{a as S,b as C}from"./chunk-ZT4NPTML.js";C();w();q();D();function y(E,e){let n=E.prepare("SELECT confidence, usage_count, successful_uses FROM qe_patterns WHERE id = ?").get(e.patternId);if(!n)return{updated:!1};let t=e.success?1:0,r=n.usage_count+1,a=n.successful_uses+t,s=a/r,i=Math.min(1,r/100),o=n.confidence*.3+i*.2+s*.5,c=E.prepare(`
|
|
3
3
|
INSERT INTO qe_pattern_usage (pattern_id, success, metrics_json, feedback)
|
|
4
4
|
VALUES (?, ?, ?, ?)
|
|
5
5
|
`),m=E.prepare(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{b as q,c as R,d as D,f as O,g as j,h as x,i as $,j as L,k as N}from"./chunk-
|
|
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.11.0");process.exit(0)}
|
|
2
|
+
import{b as q,c as R,d as D,f as O,g as j,h as x,i as $,j as L,k as N}from"./chunk-PC3VIR2A.js";import{b as v,d as P}from"./chunk-Y7TBCHW4.js";import{a as k,c as T}from"./chunk-BA4WZIAQ.js";import{a as _,b as ee}from"./chunk-ZT4NPTML.js";P();import{existsSync as E,mkdirSync as Q,writeFileSync as S,readFileSync as I,copyFileSync as te}from"fs";import{join as g,dirname as ne}from"path";async function M(t,e){if(!e.hooks.claudeCode)return!1;let n=g(t,".claude");E(n)||Q(n,{recursive:!0});let r=g(n,"settings.json"),s={};if(E(r))try{let u=I(r,"utf-8");s=v(u)}catch{s={}}let i={PreToolUse:[{matcher:"^(Write|Edit|MultiEdit)$",hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" guard --file "$TOOL_INPUT_file_path" --json',timeout:3e3,continueOnError:!0}]},{matcher:"^(Write|Edit|MultiEdit)$",hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-edit --file "$TOOL_INPUT_file_path" --json',timeout:5e3,continueOnError:!0}]},{matcher:"^Bash$",hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-command --command "$TOOL_INPUT_command" --json',timeout:3e3,continueOnError:!0}]},{matcher:"^Task$",hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" pre-task --description "$TOOL_INPUT_prompt" --json',timeout:5e3,continueOnError:!0}]}],PostToolUse:[{matcher:"^(Write|Edit|MultiEdit)$",hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-edit --file "$TOOL_INPUT_file_path" --success --json',timeout:5e3,continueOnError:!0}]},{matcher:"^Bash$",hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-command --command "$TOOL_INPUT_command" --success true --json',timeout:5e3,continueOnError:!0}]},{matcher:"^Task$",hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-task --task-id "$TOOL_RESULT_agent_id" --agent "$TOOL_INPUT_subagent_type" --success true --description "$TOOL_INPUT_prompt" --json',timeout:5e3,continueOnError:!0}]}],UserPromptSubmit:[{hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" route --json',timeout:5e3,continueOnError:!0}]}],SessionStart:[{hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" session-start --session-id "$SESSION_ID" --json',timeout:1e4,continueOnError:!0}]}],Stop:[{hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" session-end --save-state --json',timeout:5e3,continueOnError:!0}]},{hooks:[{type:"command",command:'node "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/aqe-hook.cjs" post-route --success true --json',timeout:5e3,continueOnError:!0}]}]},p=s.hooks||{};s.hooks=O(p,i);let c=s.env||{};s.env={...c,...j(e)};let m=x(e,t);for(let[u,h]of Object.entries(m))if(u==="_aqePermissions"){let d=s.permissions||{},l=d.allow||[],y=h,C=[...new Set([...l,...y])];s.permissions={...d,allow:C}}else s[u]=h;let a=s.enabledMcpjsonServers||[];return a=a.filter(u=>u!=="aqe"),a.includes("agentic-qe")||a.push("agentic-qe"),s.enabledMcpjsonServers=a,S(r,JSON.stringify(s,null,2),"utf-8"),await re(t),!0}async function re(t){let e=g(t,".claude","hooks");E(e)||Q(e,{recursive:!0});let n=g(e,"cross-phase-memory.yaml");if(E(n))return;let r=[g(ne(import.meta.url.replace("file://","")),"..","..","assets","hooks","cross-phase-memory.yaml"),g(process.cwd(),"assets","hooks","cross-phase-memory.yaml"),g(process.cwd(),"v3","assets","hooks","cross-phase-memory.yaml")];for(let i of r)try{if(E(i)){te(i,n),console.log(" \u2713 Cross-phase memory hooks installed");return}}catch{}S(n,`# Cross-Phase Memory Hooks Configuration
|
|
3
3
|
# Generated by aqe init
|
|
4
4
|
# See: https://github.com/anthropics/agentic-qe/docs/cross-phase-memory.md
|
|
5
5
|
|
|
@@ -276,7 +276,7 @@ aqe init --auto
|
|
|
276
276
|
`).run("aqe_version",JSON.stringify(e),i),s.prepare(`
|
|
277
277
|
INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
|
|
278
278
|
VALUES (?, '_system', ?, ?)
|
|
279
|
-
`).run("init_timestamp",JSON.stringify(new Date().toISOString()),i),s.close(),console.log(` \u2713 Version ${e} written to memory.db`),!0}catch(i){return s.close(),console.warn(` \u26A0 Could not write version: ${k(i)}`),!1}}catch(r){return console.warn(` \u26A0 Could not open memory.db: ${k(r)}`),!1}}async function W(t){let e=null;try{e=(await import("./better-sqlite3-
|
|
279
|
+
`).run("init_timestamp",JSON.stringify(new Date().toISOString()),i),s.close(),console.log(` \u2713 Version ${e} written to memory.db`),!0}catch(i){return s.close(),console.warn(` \u26A0 Could not write version: ${k(i)}`),!1}}catch(r){return console.warn(` \u26A0 Could not open memory.db: ${k(r)}`),!1}}async function W(t){let e=null;try{e=(await import("./better-sqlite3-RIBLRHJL.js")).default}catch{throw new Error(`SQLite persistence REQUIRED but better-sqlite3 is not installed.
|
|
280
280
|
Install it with: npm install better-sqlite3
|
|
281
281
|
If you see native compilation errors, ensure build tools are installed:
|
|
282
282
|
- macOS: xcode-select --install
|
|
@@ -302,7 +302,7 @@ Database path: ${r}
|
|
|
302
302
|
Ensure the directory is writable and has sufficient disk space.`)}}async function G(t){let e=o(t,".agentic-qe","memory.db");if(!f(e))return!1;try{let n=_(e),r=n.prepare(`
|
|
303
303
|
SELECT COUNT(*) as count FROM kv_store
|
|
304
304
|
WHERE namespace = 'code-intelligence:kg'
|
|
305
|
-
`).get();return n.close(),r.count>0}catch{return!1}}async function V(t){try{let{KnowledgeGraphService:e}=await import("./knowledge-graph-
|
|
305
|
+
`).get();return n.close(),r.count>0}catch{return!1}}async function V(t){try{let{KnowledgeGraphService:e}=await import("./knowledge-graph-ETZ65KOY.js"),{InMemoryBackend:n}=await import("./memory-backend-E3ZQKW7A.js"),r=new n;await r.initialize();let s=new e(r,{namespace:"code-intelligence:kg",enableVectorEmbeddings:!0}),p=await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:t,ignore:["node_modules/**","dist/**","coverage/**",".agentic-qe/**"]}),c=await s.index({paths:p.map(m=>o(t,m)),incremental:!1,includeTests:!0});return s.destroy(),c.success?{status:"indexed",entries:c.value.nodesCreated+c.value.edgesCreated}:{status:"error",entries:0}}catch(e){return console.warn("Code intelligence scan warning:",k(e)),{status:"skipped",entries:0}}}async function J(t){let e=o(t,".agentic-qe","memory.db");try{let n=_(e),r=n.prepare(`
|
|
306
306
|
SELECT COUNT(*) as count FROM kv_store
|
|
307
307
|
WHERE namespace LIKE 'code-intelligence:kg%'
|
|
308
308
|
`).get();return n.close(),r.count}catch{return 0}}async function B(t,e,n){if(!e.learning.enabled)return 0;let r=o(t,".agentic-qe","data");f(r)||w(r,{recursive:!0});let s=o(r,"hnsw");f(s)||w(s,{recursive:!0});let i=o(r,"learning-config.json"),p={embeddingModel:e.learning.embeddingModel,hnswConfig:e.learning.hnswConfig,qualityThreshold:e.learning.qualityThreshold,promotionThreshold:e.learning.promotionThreshold,databasePath:o(r,"memory.db"),hnswIndexPath:o(s,"index.bin"),initialized:new Date().toISOString()};b(i,JSON.stringify(p,null,2),"utf-8");let c=0;if(e.learning.pretrainedPatterns&&n){let m=n,a=new Map;for(let d of m.patterns){let l=d.domain||"general";a.has(l)||a.set(l,[]),a.get(l).push(d)}let u=o(r,"pretrained-index.json"),h={version:m.version,totalPatterns:m.statistics.totalPatterns,domains:Array.from(a.entries()).map(([d,l])=>({name:d,patternCount:l.length})),loadedAt:new Date().toISOString()};b(u,JSON.stringify(h,null,2),"utf-8");for(let[d,l]of a){let y=o(r,"patterns",d);f(y)||w(y,{recursive:!0});let C=o(y,"patterns.json");b(C,JSON.stringify(l,null,2),"utf-8"),c+=l.length}return c}return 0}async function H(t,e){if(!e.workers.daemonAutoStart||e.workers.enabled.length===0)return 0;let n=o(t,".agentic-qe","workers");f(n)||w(n,{recursive:!0});let r={},s={"pattern-consolidator":6e4,"coverage-gap-scanner":3e5,"flaky-test-detector":6e5,"routing-accuracy-monitor":12e4};for(let a of e.workers.enabled)r[a]={name:a,enabled:!0,interval:e.workers.intervals[a]||s[a]||6e4,lastRun:null,status:"pending"};let i=o(n,"registry.json"),p={version:e.version,maxConcurrent:e.workers.maxConcurrent,workers:r,createdAt:new Date().toISOString(),daemonPid:null};b(i,JSON.stringify(p,null,2),"utf-8");for(let a of e.workers.enabled){let u=o(n,`${a}.json`),h={name:a,enabled:!0,interval:e.workers.intervals[a]||s[a]||6e4,projectRoot:t,dataDir:o(t,".agentic-qe","data"),createdAt:new Date().toISOString()};b(u,JSON.stringify(h,null,2),"utf-8")}let c=o(n,"start-daemon.cjs");return b(c,`#!/usr/bin/env node
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{d as D,e as V}from"./chunk-G73PIM7X.js";V();import*as A from"node:fs";import B from"node:module";import*as N from"node:path";import{fileURLToPath as J}from"node:url";var b=D("TreeSitterWASM"),O={python:{wasmFile:"tree-sitter-python.wasm",nodeTypes:{functionDecl:["function_definition"],classDecl:["class_definition"],importDecl:["import_statement","import_from_statement"]}},java:{wasmFile:"tree-sitter-java.wasm",nodeTypes:{functionDecl:["method_declaration","constructor_declaration"],classDecl:["class_declaration","interface_declaration"],importDecl:["import_declaration"]}},csharp:{wasmFile:"tree-sitter-c_sharp.wasm",nodeTypes:{functionDecl:["method_declaration","constructor_declaration"],classDecl:["class_declaration","interface_declaration"],importDecl:["using_directive"]}},rust:{wasmFile:"tree-sitter-rust.wasm",nodeTypes:{functionDecl:["function_item"],classDecl:[],importDecl:["use_declaration"],implBlock:"impl_item",structDecl:"struct_item"}},swift:{wasmFile:"tree-sitter-swift.wasm",nodeTypes:{functionDecl:["function_declaration"],classDecl:["class_declaration"],importDecl:["import_declaration"],structDecl:"struct_declaration",protocolDecl:"protocol_declaration"}}},y=null,g=null,F=0,P=3,w=new Map;function I(i){let e=J(new URL(".",import.meta.url)),t=[N.resolve(e,"..","..","..","assets","grammars",i),N.resolve(e,"..","..","assets","grammars",i),N.resolve(process.cwd(),"assets","grammars",i),N.resolve(e,"..","assets","grammars",i)];for(let n of t)if(A.existsSync(n))return n;throw new Error(`Grammar file ${i} not found. Searched: ${t.join(", ")}`)}async function E(){if(F>=P)throw new Error(`web-tree-sitter failed to initialize after ${P} attempts`);if(!y)return g||(g=(async()=>{try{let i=await import("./web-tree-sitter-FX2EFCLH.js"),e=i.default??i;await(e.Parser?.init??e.init).call(e.Parser??e),y=e,F=0,b.info("web-tree-sitter WASM runtime initialized")}catch(i){F++,g=null;let e=i instanceof Error?i.message:String(i);throw b.warn(`web-tree-sitter WASM init failed (attempt ${F}/${P}): ${e}. `+(F<P?"Will retry on next parse.":"Falling back to regex permanently.")),i}})()),g}async function X(i){let e=w.get(i);if(e)return e;await E();let t=O[i];if(!t)throw new Error(`No WASM grammar config for ${i}`);try{let n=I(t.wasmFile),s=await y.Language.load(n);return w.set(i,s),b.info(`Loaded tree-sitter WASM grammar for ${i}`),s}catch(n){let s=n instanceof Error?n.message:String(n);throw b.warn(`Failed to load WASM grammar for ${i}: ${s}. Falling back to regex parser.`),n}}function u(i,e){let t=[];for(let n=0;n<i.childCount;n++){let s=i.child(n);e.includes(s.type)&&t.push(s)}return t}function h(i,e,t=10){let n=[];function s(r,o){if(!(o>t))for(let a=0;a<r.childCount;a++){let c=r.child(a);e.includes(c.type)&&n.push(c),s(c,o+1)}}return s(i,0),n}function x(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);(n.type==="modifiers"||n.type==="modifier"||n.type==="visibility_modifier")&&e.push(n.text.trim())}return e}function C(i,e){return x(i).some(t=>t.includes(e))}var Y=new Set(["if_statement","if_expression","if_let_statement","while_statement","while_expression","for_statement","for_in_statement","for_expression","enhanced_for_statement","match_expression","switch_statement","switch_expression","case_clause","match_arm","switch_entry","catch_clause","except_clause","catch_block","binary_expression","conditional_expression","ternary_expression"]),q=new Set(["&&","||","and","or"]);function _(i){if(!i)return 1;let e=1;function t(n){if(Y.has(n.type))if(n.type==="binary_expression"){let s=n.childForFieldName("operator");s&&q.has(s.text)&&e++}else e++;for(let s=0;s<n.childCount;s++)t(n.child(s))}return t(i),e}function S(i,e){if(!i)return[];let t=[];for(let n=0;n<i.childCount;n++){let s=i.child(n);switch(e){case"java":if(s.type==="field_declaration"){let r=x(s),o=s.childForFieldName("type")?.text?.trim(),a=s.childForFieldName("declarator"),c=a?.childForFieldName("name")?.text??a?.text?.split(/[=;]/)[0]?.trim()??"";c&&t.push({name:c,type:o||void 0,isPublic:r.some(l=>l.includes("public")),isReadonly:r.some(l=>l.includes("final"))})}break;case"csharp":if(s.type==="field_declaration"||s.type==="property_declaration"){let r=x(s),o=s.childForFieldName("type")?.text?.trim(),a=s.childForFieldName("name")?.text??"";a&&t.push({name:a,type:o||void 0,isPublic:r.some(c=>c.includes("public")),isReadonly:r.some(c=>c.includes("readonly"))})}break;case"rust":if(s.type==="field_declaration"){let r=s.childForFieldName("name")?.text??"",o=s.childForFieldName("type")?.text?.trim(),a=C(s,"pub");r&&t.push({name:r,type:o||void 0,isPublic:a,isReadonly:!1})}break;case"swift":if(s.type==="property_declaration"){let r=L(s),o=s.childForFieldName("name")?.text??"",a=s.childForFieldName("type")?.text?.trim(),c=r.includes("public")||r.includes("open"),l=s.text.includes("let ");o&&t.push({name:o,type:a||void 0,isPublic:c,isReadonly:l})}break;case"python":if(s.type==="expression_statement"){let r=s.child(0);if(r?.type==="assignment"){let o=r.childForFieldName("left");if(o?.type==="attribute"||o?.type==="identifier"){let a=o.text.replace("self.","");t.push({name:a,type:void 0,isPublic:!a.startsWith("_"),isReadonly:!1})}}}break}}return t}function k(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("parameters"),s=e.childForFieldName("return_type"),r=e.childForFieldName("body"),o=e.text.trimStart().startsWith("async"),a=W(e);return{name:t,parameters:z(n),returnType:s?.text?.trim()||void 0,isAsync:o,isPublic:!t.startsWith("_"),complexity:_(r),decorators:a,genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function z(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="identifier"){let s=n.text;if(s==="self"||s==="cls")continue;e.push({name:s,type:void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="typed_parameter"){let s=n.child(0)?.text??"";if(s==="self"||s==="cls")continue;let r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="default_parameter"||n.type==="typed_default_parameter"){let s=n.childForFieldName("name")?.text??n.child(0)?.text??"";if(s==="self"||s==="cls")continue;let r=n.childForFieldName("type")?.text?.trim(),o=n.childForFieldName("value")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!0,defaultValue:o||void 0})}else if(n.type==="list_splat_pattern"||n.type==="dictionary_splat_pattern"){let s=n.text;e.push({name:s,type:void 0,isOptional:!0,defaultValue:void 0})}}return e}function W(i){let e=[],t=i.parent;if(!t)return e;if(t.type==="decorated_definition")for(let n=0;n<t.childCount;n++){let s=t.child(n);s.type==="decorator"&&e.push(s.text.trim())}return e}function Q(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("body"),s=e.childForFieldName("superclasses"),r=[];if(s)for(let l=0;l<s.childCount;l++){let d=s.child(l);d.isNamed&&r.push(d.text)}let o=n?h(n,["function_definition"],2):[],a=k(o),c=W(e);return{name:t,methods:a,properties:S(n,"python"),isPublic:!t.startsWith("_"),implements:[],extends:r[0]||void 0,decorators:c,startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function H(i){return i.map(e=>{if(e.type==="import_from_statement"){let n=e.childForFieldName("module_name")?.text??"",s=[];for(let r=0;r<e.childCount;r++){let o=e.child(r);e.fieldNameForChild(r)==="name"&&o.isNamed&&s.push(o.text)}return{module:n,namedImports:s,isTypeOnly:!1}}return{module:e.childForFieldName("name")?.text??"",namedImports:[],isTypeOnly:!1}})}function T(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("type"),s=e.childForFieldName("parameters"),r=e.childForFieldName("body"),a=x(e).some(d=>d.includes("public")),c=n?.text?.includes("CompletableFuture")??!1,l=M(e);return{name:t,parameters:K(s),returnType:n?.text==="void"?void 0:n?.text?.trim(),isAsync:c,isPublic:a,complexity:_(r),decorators:l,genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function K(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="formal_parameter"||n.type==="spread_parameter"){let s=n.childForFieldName("name")?.text??"",r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!1,defaultValue:void 0})}}return e}function M(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="modifiers")for(let s=0;s<n.childCount;s++){let r=n.child(s);(r.type==="marker_annotation"||r.type==="annotation")&&e.push(r.text.trim())}}return e}function Z(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("body"),r=x(e).some(p=>p.includes("public")),o=e.childForFieldName("superclass")?.text,a=e.childForFieldName("interfaces"),c=[];if(a)for(let p=0;p<a.childCount;p++){let f=a.child(p);f.isNamed&&c.push(f.text)}let l=n?u(n,["method_declaration","constructor_declaration"]):[],d=T(l),m=M(e);return{name:t,methods:d,properties:S(n,"java"),isPublic:r,implements:c,extends:o||void 0,decorators:m,startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function ee(i){return i.map(e=>{let t=e.text.replace(/^\s*import\s+(static\s+)?/,"").replace(/;\s*$/,"").trim(),n=t.split("."),s=n[n.length-1];return{module:t,namedImports:s==="*"?[]:[s],isTypeOnly:!1}})}function te(i){return h(i,["method_declaration","constructor_declaration"]).map(t=>{let n=t.childForFieldName("name")?.text??"",s=t.childForFieldName("type"),r=t.childForFieldName("parameters"),o=x(t),a=o.some(d=>d.includes("public")),c=o.some(d=>d.includes("async"))||s?.text?.includes("Task")||!1,l=j(t);return{name:n,parameters:ne(r),returnType:s?.text==="void"?void 0:s?.text?.trim(),isAsync:c,isPublic:a,complexity:_(t.childForFieldName("body")),decorators:l,genericParams:[],startLine:t.startPosition.row+1,endLine:t.endPosition.row+1}})}function ne(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="parameter"){let s=n.childForFieldName("name")?.text??"",r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:r?.endsWith("?")||!1,defaultValue:void 0})}}return e}function j(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);n.type==="attribute_list"&&e.push(n.text.trim())}return e}function se(i){return h(i,["class_declaration","interface_declaration"]).map(t=>{let n=t.childForFieldName("name")?.text??"",s=t.childForFieldName("body"),o=x(t).some(p=>p.includes("public")),a=t.childForFieldName("bases"),c=[];if(a)for(let p=0;p<a.childCount;p++){let f=a.child(p);f.isNamed&&c.push(f.text)}let l=s?u(s,["method_declaration","constructor_declaration"]):[],d=T(l),m=j(t);return{name:n,methods:d,properties:S(s,"csharp"),isPublic:o,implements:c.slice(1),extends:c[0]||void 0,decorators:m,startLine:t.startPosition.row+1,endLine:t.endPosition.row+1}})}function ie(i){return h(i,["using_directive"]).map(t=>({module:t.text.replace(/^\s*using\s+(static\s+)?/,"").replace(/;\s*$/,"").trim(),namedImports:[],isTypeOnly:!1}))}function re(i,e){let t=[],n=u(i,e.nodeTypes.functionDecl);if(t.push(...n.map(U)),e.nodeTypes.implBlock){let s=u(i,[e.nodeTypes.implBlock]);for(let r of s){let o=r.childForFieldName("body");if(o){let a=u(o,e.nodeTypes.functionDecl);t.push(...a.map(U))}}}return t}function U(i){let e=i.childForFieldName("name")?.text??"",t=i.childForFieldName("parameters"),n=i.childForFieldName("return_type"),s=i.childForFieldName("body"),r=C(i,"pub"),o=i.text.trimStart().startsWith("pub async")||i.text.trimStart().startsWith("async"),a=G(i);return{name:e,parameters:oe(t),returnType:n?.text?.trim()||void 0,isAsync:o,isPublic:r,complexity:_(s),decorators:a,genericParams:[],startLine:i.startPosition.row+1,endLine:i.endPosition.row+1}}function oe(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="parameter"){let s=n.childForFieldName("pattern"),r=n.childForFieldName("type"),o=s?.text??"",a=r?.text?.trim();e.push({name:o,type:a||void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="self_parameter")continue}return e}function G(i){let e=[],t=i.previousNamedSibling;for(;t&&t.type==="attribute_item";)e.unshift(t.text.trim()),t=t.previousNamedSibling;return e}function ae(i){let e=[],t=u(i,["struct_item","enum_item","trait_item"]);for(let n of t){let s=n.childForFieldName("name")?.text??"",r=C(n,"pub"),o=G(n),a=n.childForFieldName("body");e.push({name:s,methods:[],properties:S(a,"rust"),isPublic:r,implements:[],extends:void 0,decorators:o,startLine:n.startPosition.row+1,endLine:n.endPosition.row+1})}return e}function ce(i){return u(i,["use_declaration"]).map(t=>({module:t.childForFieldName("argument")?.text??t.text.replace(/^\s*use\s+/,"").replace(/;\s*$/,"").trim(),namedImports:[],isTypeOnly:!1}))}function $(i){return i.map(e=>{let t="",n=[],s,r=L(e),o=r.includes("public")||r.includes("open"),a=!1;for(let l=0;l<e.childCount;l++){let d=e.child(l);e.fieldNameForChild(l)==="name"&&(d.type==="simple_identifier"?t=d.text:t||(s=d.text)),d.type==="parameter"&&n.push(d),(d.type==="async"||d.text==="async")&&(a=!0)}if(!t){for(let l=0;l<e.childCount;l++)if(e.child(l).type==="simple_identifier"){t=e.child(l).text;break}}let c=null;for(let l=0;l<e.childCount;l++)if(e.child(l).type==="function_body"){c=e.child(l);break}return{name:t,parameters:le(n),returnType:s,isAsync:a,isPublic:o,complexity:_(c),decorators:[],genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function L(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="modifiers")for(let s=0;s<n.childCount;s++)e.push(n.child(s).text.trim())}return e}function le(i){return i.map(e=>{let n=e.text.split(":"),s=n[0]?.trim().split(/\s+/)??[],r=s[s.length-1]||"",o=n.slice(1).join(":").trim()||void 0;return{name:r,type:o,isOptional:o?.endsWith("?")||!1,defaultValue:void 0}})}function de(i){return u(i,["class_declaration","struct_declaration","protocol_declaration"]).map(n=>{let s=n.childForFieldName("name"),r=s?.text??"",o=L(n),a=o.includes("public")||o.includes("open"),c=[];for(let p=0;p<n.childCount;p++){let f=n.child(p);f.type==="type_identifier"&&f!==s&&c.push(f.text),(f.type==="inheritance_specifier"||f.type==="user_type")&&c.push(f.text)}let l=n.childForFieldName("body"),d=l?h(l,["function_declaration"],2):[],m=$(d);return{name:r,methods:m,properties:S(l,"swift"),isPublic:a,implements:c.slice(1),extends:c[0]||void 0,decorators:[],startLine:n.startPosition.row+1,endLine:n.endPosition.row+1}})}function ue(i){return u(i,["import_declaration"]).map(t=>{let n="";for(let s=0;s<t.childCount;s++){let r=t.child(s);(r.type==="identifier"||r.type==="simple_identifier")&&(n=r.text)}return{module:n,namedImports:[],isTypeOnly:!1}})}var v=class{language;supportedExtensions;constructor(e,t){this.language=e,this.supportedExtensions=t}async parseFile(e,t){let n=await X(this.language),s=y.Parser??y,r=new s;r.setLanguage(n);let o=r.parse(e),a=o.rootNode;try{return{...this.extractFromAST(a),language:this.language,filePath:t}}finally{o.delete(),r.delete()}}extractFromAST(e){let t=O[this.language];switch(this.language){case"python":{let n=u(e,t.nodeTypes.functionDecl),s=u(e,["decorated_definition"]).map(d=>{for(let m=0;m<d.childCount;m++)if(t.nodeTypes.functionDecl.includes(d.child(m).type))return d.child(m);return null}).filter(Boolean),r=[...n,...s],o=u(e,t.nodeTypes.classDecl),a=u(e,["decorated_definition"]).map(d=>{for(let m=0;m<d.childCount;m++)if(t.nodeTypes.classDecl.includes(d.child(m).type))return d.child(m);return null}).filter(Boolean),c=[...o,...a],l=u(e,t.nodeTypes.importDecl);return{functions:k(r),classes:Q(c),imports:H(l)}}case"java":{let n=h(e,t.nodeTypes.classDecl),s=u(e,t.nodeTypes.importDecl),o=[...u(e,t.nodeTypes.functionDecl)];for(let a of n){let c=a.childForFieldName("body");c&&o.push(...u(c,t.nodeTypes.functionDecl))}return{functions:T(o),classes:Z(n),imports:ee(s)}}case"csharp":return{functions:te(e),classes:se(e),imports:ie(e)};case"rust":return{functions:re(e,t),classes:ae(e),imports:ce(e)};case"swift":{let n=h(e,t.nodeTypes.functionDecl);return{functions:$(n),classes:de(e),imports:ue(e)}}default:return{functions:[],classes:[],imports:[]}}}},me={python:[".py"],java:[".java"],csharp:[".cs"],rust:[".rs"],swift:[".swift"]};function xe(){let i=new Map;for(let[e,t]of Object.entries(me))i.set(e,new v(e,t));return i}function pe(){if(process.env.AQE_PARSER_REGEX_ONLY==="1"||process.env.AQE_PARSER_REGEX_ONLY==="true")return!1;try{let{createRequire:i}=B;return i(import.meta.url).resolve("web-tree-sitter"),I("tree-sitter-python.wasm"),!0}catch{return!1}}var R=new Map;async function Fe(i){if(!pe())return null;try{await E();let e=R.get(i);return e||(e=await y.Language.load(I(i)),R.set(i,e)),{parse:t=>{let n=y.Parser??y,s=new n;s.setLanguage(e);let r=s.parse(t);return s.delete?.(),r}}}catch{return null}}function Ne(){y=null,g=null,F=0,w.clear()}export{v as a,xe as b,pe as c,Fe as d,Ne as e};
|
|
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.11.0");process.exit(0)}
|
|
2
|
+
import{d as D,e as V}from"./chunk-F62ZQZQQ.js";V();import*as A from"node:fs";import B from"node:module";import*as N from"node:path";import{fileURLToPath as J}from"node:url";var b=D("TreeSitterWASM"),O={python:{wasmFile:"tree-sitter-python.wasm",nodeTypes:{functionDecl:["function_definition"],classDecl:["class_definition"],importDecl:["import_statement","import_from_statement"]}},java:{wasmFile:"tree-sitter-java.wasm",nodeTypes:{functionDecl:["method_declaration","constructor_declaration"],classDecl:["class_declaration","interface_declaration"],importDecl:["import_declaration"]}},csharp:{wasmFile:"tree-sitter-c_sharp.wasm",nodeTypes:{functionDecl:["method_declaration","constructor_declaration"],classDecl:["class_declaration","interface_declaration"],importDecl:["using_directive"]}},rust:{wasmFile:"tree-sitter-rust.wasm",nodeTypes:{functionDecl:["function_item"],classDecl:[],importDecl:["use_declaration"],implBlock:"impl_item",structDecl:"struct_item"}},swift:{wasmFile:"tree-sitter-swift.wasm",nodeTypes:{functionDecl:["function_declaration"],classDecl:["class_declaration"],importDecl:["import_declaration"],structDecl:"struct_declaration",protocolDecl:"protocol_declaration"}}},y=null,g=null,F=0,P=3,w=new Map;function I(i){let e=J(new URL(".",import.meta.url)),t=[N.resolve(e,"..","..","..","assets","grammars",i),N.resolve(e,"..","..","assets","grammars",i),N.resolve(process.cwd(),"assets","grammars",i),N.resolve(e,"..","assets","grammars",i)];for(let n of t)if(A.existsSync(n))return n;throw new Error(`Grammar file ${i} not found. Searched: ${t.join(", ")}`)}async function E(){if(F>=P)throw new Error(`web-tree-sitter failed to initialize after ${P} attempts`);if(!y)return g||(g=(async()=>{try{let i=await import("./web-tree-sitter-TSNVGWSN.js"),e=i.default??i;await(e.Parser?.init??e.init).call(e.Parser??e),y=e,F=0,b.info("web-tree-sitter WASM runtime initialized")}catch(i){F++,g=null;let e=i instanceof Error?i.message:String(i);throw b.warn(`web-tree-sitter WASM init failed (attempt ${F}/${P}): ${e}. `+(F<P?"Will retry on next parse.":"Falling back to regex permanently.")),i}})()),g}async function X(i){let e=w.get(i);if(e)return e;await E();let t=O[i];if(!t)throw new Error(`No WASM grammar config for ${i}`);try{let n=I(t.wasmFile),s=await y.Language.load(n);return w.set(i,s),b.info(`Loaded tree-sitter WASM grammar for ${i}`),s}catch(n){let s=n instanceof Error?n.message:String(n);throw b.warn(`Failed to load WASM grammar for ${i}: ${s}. Falling back to regex parser.`),n}}function u(i,e){let t=[];for(let n=0;n<i.childCount;n++){let s=i.child(n);e.includes(s.type)&&t.push(s)}return t}function h(i,e,t=10){let n=[];function s(r,o){if(!(o>t))for(let a=0;a<r.childCount;a++){let c=r.child(a);e.includes(c.type)&&n.push(c),s(c,o+1)}}return s(i,0),n}function x(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);(n.type==="modifiers"||n.type==="modifier"||n.type==="visibility_modifier")&&e.push(n.text.trim())}return e}function C(i,e){return x(i).some(t=>t.includes(e))}var Y=new Set(["if_statement","if_expression","if_let_statement","while_statement","while_expression","for_statement","for_in_statement","for_expression","enhanced_for_statement","match_expression","switch_statement","switch_expression","case_clause","match_arm","switch_entry","catch_clause","except_clause","catch_block","binary_expression","conditional_expression","ternary_expression"]),q=new Set(["&&","||","and","or"]);function _(i){if(!i)return 1;let e=1;function t(n){if(Y.has(n.type))if(n.type==="binary_expression"){let s=n.childForFieldName("operator");s&&q.has(s.text)&&e++}else e++;for(let s=0;s<n.childCount;s++)t(n.child(s))}return t(i),e}function S(i,e){if(!i)return[];let t=[];for(let n=0;n<i.childCount;n++){let s=i.child(n);switch(e){case"java":if(s.type==="field_declaration"){let r=x(s),o=s.childForFieldName("type")?.text?.trim(),a=s.childForFieldName("declarator"),c=a?.childForFieldName("name")?.text??a?.text?.split(/[=;]/)[0]?.trim()??"";c&&t.push({name:c,type:o||void 0,isPublic:r.some(l=>l.includes("public")),isReadonly:r.some(l=>l.includes("final"))})}break;case"csharp":if(s.type==="field_declaration"||s.type==="property_declaration"){let r=x(s),o=s.childForFieldName("type")?.text?.trim(),a=s.childForFieldName("name")?.text??"";a&&t.push({name:a,type:o||void 0,isPublic:r.some(c=>c.includes("public")),isReadonly:r.some(c=>c.includes("readonly"))})}break;case"rust":if(s.type==="field_declaration"){let r=s.childForFieldName("name")?.text??"",o=s.childForFieldName("type")?.text?.trim(),a=C(s,"pub");r&&t.push({name:r,type:o||void 0,isPublic:a,isReadonly:!1})}break;case"swift":if(s.type==="property_declaration"){let r=L(s),o=s.childForFieldName("name")?.text??"",a=s.childForFieldName("type")?.text?.trim(),c=r.includes("public")||r.includes("open"),l=s.text.includes("let ");o&&t.push({name:o,type:a||void 0,isPublic:c,isReadonly:l})}break;case"python":if(s.type==="expression_statement"){let r=s.child(0);if(r?.type==="assignment"){let o=r.childForFieldName("left");if(o?.type==="attribute"||o?.type==="identifier"){let a=o.text.replace("self.","");t.push({name:a,type:void 0,isPublic:!a.startsWith("_"),isReadonly:!1})}}}break}}return t}function k(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("parameters"),s=e.childForFieldName("return_type"),r=e.childForFieldName("body"),o=e.text.trimStart().startsWith("async"),a=W(e);return{name:t,parameters:z(n),returnType:s?.text?.trim()||void 0,isAsync:o,isPublic:!t.startsWith("_"),complexity:_(r),decorators:a,genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function z(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="identifier"){let s=n.text;if(s==="self"||s==="cls")continue;e.push({name:s,type:void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="typed_parameter"){let s=n.child(0)?.text??"";if(s==="self"||s==="cls")continue;let r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="default_parameter"||n.type==="typed_default_parameter"){let s=n.childForFieldName("name")?.text??n.child(0)?.text??"";if(s==="self"||s==="cls")continue;let r=n.childForFieldName("type")?.text?.trim(),o=n.childForFieldName("value")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!0,defaultValue:o||void 0})}else if(n.type==="list_splat_pattern"||n.type==="dictionary_splat_pattern"){let s=n.text;e.push({name:s,type:void 0,isOptional:!0,defaultValue:void 0})}}return e}function W(i){let e=[],t=i.parent;if(!t)return e;if(t.type==="decorated_definition")for(let n=0;n<t.childCount;n++){let s=t.child(n);s.type==="decorator"&&e.push(s.text.trim())}return e}function Q(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("body"),s=e.childForFieldName("superclasses"),r=[];if(s)for(let l=0;l<s.childCount;l++){let d=s.child(l);d.isNamed&&r.push(d.text)}let o=n?h(n,["function_definition"],2):[],a=k(o),c=W(e);return{name:t,methods:a,properties:S(n,"python"),isPublic:!t.startsWith("_"),implements:[],extends:r[0]||void 0,decorators:c,startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function H(i){return i.map(e=>{if(e.type==="import_from_statement"){let n=e.childForFieldName("module_name")?.text??"",s=[];for(let r=0;r<e.childCount;r++){let o=e.child(r);e.fieldNameForChild(r)==="name"&&o.isNamed&&s.push(o.text)}return{module:n,namedImports:s,isTypeOnly:!1}}return{module:e.childForFieldName("name")?.text??"",namedImports:[],isTypeOnly:!1}})}function T(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("type"),s=e.childForFieldName("parameters"),r=e.childForFieldName("body"),a=x(e).some(d=>d.includes("public")),c=n?.text?.includes("CompletableFuture")??!1,l=M(e);return{name:t,parameters:K(s),returnType:n?.text==="void"?void 0:n?.text?.trim(),isAsync:c,isPublic:a,complexity:_(r),decorators:l,genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function K(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="formal_parameter"||n.type==="spread_parameter"){let s=n.childForFieldName("name")?.text??"",r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!1,defaultValue:void 0})}}return e}function M(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="modifiers")for(let s=0;s<n.childCount;s++){let r=n.child(s);(r.type==="marker_annotation"||r.type==="annotation")&&e.push(r.text.trim())}}return e}function Z(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("body"),r=x(e).some(p=>p.includes("public")),o=e.childForFieldName("superclass")?.text,a=e.childForFieldName("interfaces"),c=[];if(a)for(let p=0;p<a.childCount;p++){let f=a.child(p);f.isNamed&&c.push(f.text)}let l=n?u(n,["method_declaration","constructor_declaration"]):[],d=T(l),m=M(e);return{name:t,methods:d,properties:S(n,"java"),isPublic:r,implements:c,extends:o||void 0,decorators:m,startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function ee(i){return i.map(e=>{let t=e.text.replace(/^\s*import\s+(static\s+)?/,"").replace(/;\s*$/,"").trim(),n=t.split("."),s=n[n.length-1];return{module:t,namedImports:s==="*"?[]:[s],isTypeOnly:!1}})}function te(i){return h(i,["method_declaration","constructor_declaration"]).map(t=>{let n=t.childForFieldName("name")?.text??"",s=t.childForFieldName("type"),r=t.childForFieldName("parameters"),o=x(t),a=o.some(d=>d.includes("public")),c=o.some(d=>d.includes("async"))||s?.text?.includes("Task")||!1,l=j(t);return{name:n,parameters:ne(r),returnType:s?.text==="void"?void 0:s?.text?.trim(),isAsync:c,isPublic:a,complexity:_(t.childForFieldName("body")),decorators:l,genericParams:[],startLine:t.startPosition.row+1,endLine:t.endPosition.row+1}})}function ne(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="parameter"){let s=n.childForFieldName("name")?.text??"",r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:r?.endsWith("?")||!1,defaultValue:void 0})}}return e}function j(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);n.type==="attribute_list"&&e.push(n.text.trim())}return e}function se(i){return h(i,["class_declaration","interface_declaration"]).map(t=>{let n=t.childForFieldName("name")?.text??"",s=t.childForFieldName("body"),o=x(t).some(p=>p.includes("public")),a=t.childForFieldName("bases"),c=[];if(a)for(let p=0;p<a.childCount;p++){let f=a.child(p);f.isNamed&&c.push(f.text)}let l=s?u(s,["method_declaration","constructor_declaration"]):[],d=T(l),m=j(t);return{name:n,methods:d,properties:S(s,"csharp"),isPublic:o,implements:c.slice(1),extends:c[0]||void 0,decorators:m,startLine:t.startPosition.row+1,endLine:t.endPosition.row+1}})}function ie(i){return h(i,["using_directive"]).map(t=>({module:t.text.replace(/^\s*using\s+(static\s+)?/,"").replace(/;\s*$/,"").trim(),namedImports:[],isTypeOnly:!1}))}function re(i,e){let t=[],n=u(i,e.nodeTypes.functionDecl);if(t.push(...n.map(U)),e.nodeTypes.implBlock){let s=u(i,[e.nodeTypes.implBlock]);for(let r of s){let o=r.childForFieldName("body");if(o){let a=u(o,e.nodeTypes.functionDecl);t.push(...a.map(U))}}}return t}function U(i){let e=i.childForFieldName("name")?.text??"",t=i.childForFieldName("parameters"),n=i.childForFieldName("return_type"),s=i.childForFieldName("body"),r=C(i,"pub"),o=i.text.trimStart().startsWith("pub async")||i.text.trimStart().startsWith("async"),a=G(i);return{name:e,parameters:oe(t),returnType:n?.text?.trim()||void 0,isAsync:o,isPublic:r,complexity:_(s),decorators:a,genericParams:[],startLine:i.startPosition.row+1,endLine:i.endPosition.row+1}}function oe(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="parameter"){let s=n.childForFieldName("pattern"),r=n.childForFieldName("type"),o=s?.text??"",a=r?.text?.trim();e.push({name:o,type:a||void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="self_parameter")continue}return e}function G(i){let e=[],t=i.previousNamedSibling;for(;t&&t.type==="attribute_item";)e.unshift(t.text.trim()),t=t.previousNamedSibling;return e}function ae(i){let e=[],t=u(i,["struct_item","enum_item","trait_item"]);for(let n of t){let s=n.childForFieldName("name")?.text??"",r=C(n,"pub"),o=G(n),a=n.childForFieldName("body");e.push({name:s,methods:[],properties:S(a,"rust"),isPublic:r,implements:[],extends:void 0,decorators:o,startLine:n.startPosition.row+1,endLine:n.endPosition.row+1})}return e}function ce(i){return u(i,["use_declaration"]).map(t=>({module:t.childForFieldName("argument")?.text??t.text.replace(/^\s*use\s+/,"").replace(/;\s*$/,"").trim(),namedImports:[],isTypeOnly:!1}))}function $(i){return i.map(e=>{let t="",n=[],s,r=L(e),o=r.includes("public")||r.includes("open"),a=!1;for(let l=0;l<e.childCount;l++){let d=e.child(l);e.fieldNameForChild(l)==="name"&&(d.type==="simple_identifier"?t=d.text:t||(s=d.text)),d.type==="parameter"&&n.push(d),(d.type==="async"||d.text==="async")&&(a=!0)}if(!t){for(let l=0;l<e.childCount;l++)if(e.child(l).type==="simple_identifier"){t=e.child(l).text;break}}let c=null;for(let l=0;l<e.childCount;l++)if(e.child(l).type==="function_body"){c=e.child(l);break}return{name:t,parameters:le(n),returnType:s,isAsync:a,isPublic:o,complexity:_(c),decorators:[],genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function L(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="modifiers")for(let s=0;s<n.childCount;s++)e.push(n.child(s).text.trim())}return e}function le(i){return i.map(e=>{let n=e.text.split(":"),s=n[0]?.trim().split(/\s+/)??[],r=s[s.length-1]||"",o=n.slice(1).join(":").trim()||void 0;return{name:r,type:o,isOptional:o?.endsWith("?")||!1,defaultValue:void 0}})}function de(i){return u(i,["class_declaration","struct_declaration","protocol_declaration"]).map(n=>{let s=n.childForFieldName("name"),r=s?.text??"",o=L(n),a=o.includes("public")||o.includes("open"),c=[];for(let p=0;p<n.childCount;p++){let f=n.child(p);f.type==="type_identifier"&&f!==s&&c.push(f.text),(f.type==="inheritance_specifier"||f.type==="user_type")&&c.push(f.text)}let l=n.childForFieldName("body"),d=l?h(l,["function_declaration"],2):[],m=$(d);return{name:r,methods:m,properties:S(l,"swift"),isPublic:a,implements:c.slice(1),extends:c[0]||void 0,decorators:[],startLine:n.startPosition.row+1,endLine:n.endPosition.row+1}})}function ue(i){return u(i,["import_declaration"]).map(t=>{let n="";for(let s=0;s<t.childCount;s++){let r=t.child(s);(r.type==="identifier"||r.type==="simple_identifier")&&(n=r.text)}return{module:n,namedImports:[],isTypeOnly:!1}})}var v=class{language;supportedExtensions;constructor(e,t){this.language=e,this.supportedExtensions=t}async parseFile(e,t){let n=await X(this.language),s=y.Parser??y,r=new s;r.setLanguage(n);let o=r.parse(e),a=o.rootNode;try{return{...this.extractFromAST(a),language:this.language,filePath:t}}finally{o.delete(),r.delete()}}extractFromAST(e){let t=O[this.language];switch(this.language){case"python":{let n=u(e,t.nodeTypes.functionDecl),s=u(e,["decorated_definition"]).map(d=>{for(let m=0;m<d.childCount;m++)if(t.nodeTypes.functionDecl.includes(d.child(m).type))return d.child(m);return null}).filter(Boolean),r=[...n,...s],o=u(e,t.nodeTypes.classDecl),a=u(e,["decorated_definition"]).map(d=>{for(let m=0;m<d.childCount;m++)if(t.nodeTypes.classDecl.includes(d.child(m).type))return d.child(m);return null}).filter(Boolean),c=[...o,...a],l=u(e,t.nodeTypes.importDecl);return{functions:k(r),classes:Q(c),imports:H(l)}}case"java":{let n=h(e,t.nodeTypes.classDecl),s=u(e,t.nodeTypes.importDecl),o=[...u(e,t.nodeTypes.functionDecl)];for(let a of n){let c=a.childForFieldName("body");c&&o.push(...u(c,t.nodeTypes.functionDecl))}return{functions:T(o),classes:Z(n),imports:ee(s)}}case"csharp":return{functions:te(e),classes:se(e),imports:ie(e)};case"rust":return{functions:re(e,t),classes:ae(e),imports:ce(e)};case"swift":{let n=h(e,t.nodeTypes.functionDecl);return{functions:$(n),classes:de(e),imports:ue(e)}}default:return{functions:[],classes:[],imports:[]}}}},me={python:[".py"],java:[".java"],csharp:[".cs"],rust:[".rs"],swift:[".swift"]};function xe(){let i=new Map;for(let[e,t]of Object.entries(me))i.set(e,new v(e,t));return i}function pe(){if(process.env.AQE_PARSER_REGEX_ONLY==="1"||process.env.AQE_PARSER_REGEX_ONLY==="true")return!1;try{let{createRequire:i}=B;return i(import.meta.url).resolve("web-tree-sitter"),I("tree-sitter-python.wasm"),!0}catch{return!1}}var R=new Map;async function Fe(i){if(!pe())return null;try{await E();let e=R.get(i);return e||(e=await y.Language.load(I(i)),R.set(i,e)),{parse:t=>{let n=y.Parser??y,s=new n;s.setLanguage(e);let r=s.parse(t);return s.delete?.(),r}}}catch{return null}}function Ne(){y=null,g=null,F=0,w.clear()}export{v as a,xe as b,pe as c,Fe as d,Ne as e};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{d as be}from"./chunk-Z4WAJ647.js";import{a as Le}from"./chunk-2B2RLPK3.js";import{c as fe,d as ge,e as Pe}from"./chunk-G73PIM7X.js";import{b as D,d as ye}from"./chunk-DDMKCHYT.js";import{b as P,c as L}from"./chunk-D7ZVIL3C.js";import{a as G,b as A,c as J}from"./chunk-MTWBYHMS.js";Le();import{createRequire as Ce}from"module";var O;function W(){if(!O){let u=Ce(import.meta.url);try{O=u("typescript")}catch{try{O=u("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 m=new Proxy({},{get(u,e){return W()[e]},has(u,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(u,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var N=class{parseFile(e,t){return m.createSourceFile(e,t,m.ScriptTarget.Latest,!0,this.getScriptKind(e))}extractFunctions(e){let t=[],s=n=>{m.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):m.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{m.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{m.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(m.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(m.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(m.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(m.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(m.isVariableStatement(n)&&this.hasExportModifier(n))for(let i of n.declarationList.declarations)m.isIdentifier(i.name)&&t.push({name:i.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else m.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):m.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):m.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{m.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],i=this.extractFunctions(s);for(let a of i)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 r=this.extractInterfaces(s);for(let a of r)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")?m.ScriptKind.TSX:e.endsWith(".ts")?m.ScriptKind.TS:e.endsWith(".jsx")?m.ScriptKind.JSX:e.endsWith(".js")?m.ScriptKind.JS:m.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(m.isIdentifier(n.name)&&n.initializer&&m.isArrowFunction(n.initializer)){let i=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:r}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(i.parameters),returnType:i.type?i.type.getText(t):void 0,startLine:o+1,endLine:r+1,isAsync:this.hasAsyncModifier(i),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(i.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),i=[],o=[];for(let c of e.members)m.isMethodDeclaration(c)&&c.name?i.push(this.extractMethodDeclaration(c,t)):m.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):m.isConstructorDeclaration(c)&&(i.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let r,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===m.SyntaxKind.ExtendsKeyword)r=c.types[0]?.expression.getText(t);else if(c.token===m.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:i,properties:o,extends:r,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:m.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===m.SyntaxKind.PublicKeyword||t.kind===m.SyntaxKind.PrivateKeyword||t.kind===m.SyntaxKind.ProtectedKeyword||t.kind===m.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,i,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(m.isNamespaceImport(e.importClause.namedBindings))i=e.importClause.namedBindings.name.text;else if(m.isNamedImports(e.importClause.namedBindings))for(let r of e.importClause.namedBindings.elements)s.push({name:r.propertyName?.text??r.name.text,alias:r.propertyName?r.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:i,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&m.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()),i=[],o=[];for(let a of e.members)m.isPropertySignature(a)&&a.name?i.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):m.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 r=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===m.SyntaxKind.ExtendsKeyword)for(let c of a.types)r.push(c.expression.getText(t))}return{name:e.name.text,properties:i,methods:o,extends:r,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:m.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 m.isIdentifier(e)||m.isStringLiteral(e)||m.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return m.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!m.canHaveModifiers(e))return"public";let t=m.getModifiers(e);return t?t.some(s=>s.kind===m.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===m.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},We=new N,Q=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new N;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),i=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(r=>this.mapFunction(r)),classes:i.map(r=>this.mapClass(r)),imports:o.map(r=>this.mapImport(r)),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}}},ze=new Q;Pe();var E=1e3;function I(u){let e=u.split(`
|
|
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.11.0");process.exit(0)}
|
|
2
|
+
import{d as be}from"./chunk-KOOY72E3.js";import{a as Le}from"./chunk-C4OYHUJV.js";import{c as fe,d as ge,e as Pe}from"./chunk-F62ZQZQQ.js";import{b as D,d as ye}from"./chunk-Y7TBCHW4.js";import{b as P,c as L}from"./chunk-XMZ2DHUL.js";import{a as G,b as A,c as J}from"./chunk-BA4WZIAQ.js";Le();import{createRequire as Ce}from"module";var O;function W(){if(!O){let u=Ce(import.meta.url);try{O=u("typescript")}catch{try{O=u("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 m=new Proxy({},{get(u,e){return W()[e]},has(u,e){return e in W()},ownKeys(){return Object.keys(W())},getOwnPropertyDescriptor(u,e){let t=W()[e];if(t!==void 0)return{configurable:!0,enumerable:!0,value:t}}});var N=class{parseFile(e,t){return m.createSourceFile(e,t,m.ScriptTarget.Latest,!0,this.getScriptKind(e))}extractFunctions(e){let t=[],s=n=>{m.isFunctionDeclaration(n)&&n.name?t.push(this.extractFunctionDeclaration(n,e)):m.isVariableStatement(n)&&this.extractArrowFunctions(n,e,t),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractClasses(e){let t=[],s=n=>{m.isClassDeclaration(n)&&n.name&&t.push(this.extractClassDeclaration(n,e)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractImports(e){let t=[],s=n=>{m.isImportDeclaration(n)&&t.push(this.extractImportDeclaration(n)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractExports(e){let t=[],s=n=>{if(m.isExportDeclaration(n))this.extractExportDeclaration(n,t);else if(m.isExportAssignment(n))t.push({name:this.getExportAssignmentName(n),type:"unknown",isDefault:!0,isReexport:!1,sourceModule:void 0});else if(m.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(m.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(m.isVariableStatement(n)&&this.hasExportModifier(n))for(let i of n.declarationList.declarations)m.isIdentifier(i.name)&&t.push({name:i.name.text,type:"variable",isDefault:!1,isReexport:!1,sourceModule:void 0});else m.isInterfaceDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"interface",isDefault:!1,isReexport:!1,sourceModule:void 0}):m.isTypeAliasDeclaration(n)&&this.hasExportModifier(n)?t.push({name:n.name.text,type:"type",isDefault:!1,isReexport:!1,sourceModule:void 0}):m.isEnumDeclaration(n)&&this.hasExportModifier(n)&&t.push({name:n.name.text,type:"enum",isDefault:!1,isReexport:!1,sourceModule:void 0});m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractInterfaces(e){let t=[],s=n=>{m.isInterfaceDeclaration(n)&&t.push(this.extractInterfaceDeclaration(n,e)),m.forEachChild(n,s)};return m.forEachChild(e,s),t}extractEntities(e,t){let s=this.parseFile(t,e),n=[],i=this.extractFunctions(s);for(let a of i)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 r=this.extractInterfaces(s);for(let a of r)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")?m.ScriptKind.TSX:e.endsWith(".ts")?m.ScriptKind.TS:e.endsWith(".jsx")?m.ScriptKind.JSX:e.endsWith(".js")?m.ScriptKind.JS:m.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(m.isIdentifier(n.name)&&n.initializer&&m.isArrowFunction(n.initializer)){let i=n.initializer,{line:o}=t.getLineAndCharacterOfPosition(e.getStart()),{line:r}=t.getLineAndCharacterOfPosition(e.getEnd());s.push({name:n.name.text,parameters:this.extractParameters(i.parameters),returnType:i.type?i.type.getText(t):void 0,startLine:o+1,endLine:r+1,isAsync:this.hasAsyncModifier(i),isExported:this.hasExportModifier(e),isGenerator:!1,typeParameters:this.extractTypeParameters(i.typeParameters)})}}extractClassDeclaration(e,t){let{line:s}=t.getLineAndCharacterOfPosition(e.getStart()),{line:n}=t.getLineAndCharacterOfPosition(e.getEnd()),i=[],o=[];for(let c of e.members)m.isMethodDeclaration(c)&&c.name?i.push(this.extractMethodDeclaration(c,t)):m.isPropertyDeclaration(c)&&c.name?o.push(this.extractPropertyDeclaration(c,t)):m.isConstructorDeclaration(c)&&(i.push(this.extractConstructor(c,t)),this.extractParameterProperties(c,o,t));let r,a=[];if(e.heritageClauses){for(let c of e.heritageClauses)if(c.token===m.SyntaxKind.ExtendsKeyword)r=c.types[0]?.expression.getText(t);else if(c.token===m.SyntaxKind.ImplementsKeyword)for(let l of c.types)a.push(l.expression.getText(t))}return{name:e.name?.text??"anonymous",methods:i,properties:o,extends:r,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:m.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===m.SyntaxKind.PublicKeyword||t.kind===m.SyntaxKind.PrivateKeyword||t.kind===m.SyntaxKind.ProtectedKeyword||t.kind===m.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,i,o=e.importClause?.isTypeOnly??!1;if(e.importClause&&(e.importClause.name&&(n=e.importClause.name.text),e.importClause.namedBindings)){if(m.isNamespaceImport(e.importClause.namedBindings))i=e.importClause.namedBindings.name.text;else if(m.isNamedImports(e.importClause.namedBindings))for(let r of e.importClause.namedBindings.elements)s.push({name:r.propertyName?.text??r.name.text,alias:r.propertyName?r.name.text:void 0})}return{module:t,namedImports:s,defaultImport:n,namespaceImport:i,isTypeOnly:o}}extractExportDeclaration(e,t){let s=e.moduleSpecifier?e.moduleSpecifier.text:void 0;if(e.exportClause&&m.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()),i=[],o=[];for(let a of e.members)m.isPropertySignature(a)&&a.name?i.push({name:this.getPropertyName(a.name,t),type:a.type?a.type.getText(t):void 0,isOptional:!!a.questionToken,isReadonly:this.hasReadonlyModifier(a)}):m.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 r=[];if(e.heritageClauses){for(let a of e.heritageClauses)if(a.token===m.SyntaxKind.ExtendsKeyword)for(let c of a.types)r.push(c.expression.getText(t))}return{name:e.name.text,properties:i,methods:o,extends:r,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:m.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 m.isIdentifier(e)||m.isStringLiteral(e)||m.isNumericLiteral(e)?e.text:e.getText(t)}getExportAssignmentName(e){return m.isIdentifier(e.expression)?e.expression.text:"default"}hasExportModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.ExportKeyword)}hasDefaultModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.DefaultKeyword)}hasAsyncModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.AsyncKeyword)}hasStaticModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.StaticKeyword)}hasAbstractModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.AbstractKeyword)}hasReadonlyModifier(e){return m.canHaveModifiers(e)&&!!m.getModifiers(e)?.some(t=>t.kind===m.SyntaxKind.ReadonlyKeyword)}getVisibility(e){if(!m.canHaveModifiers(e))return"public";let t=m.getModifiers(e);return t?t.some(s=>s.kind===m.SyntaxKind.PrivateKeyword)?"private":t.some(s=>s.kind===m.SyntaxKind.ProtectedKeyword)?"protected":"public":"public"}},We=new N,Q=class{language="typescript";supportedExtensions=[".ts",".tsx",".js",".jsx",".mjs",".cjs"];parser=new N;async parseFile(e,t){let s=this.parser.parseFile(t,e),n=this.parser.extractFunctions(s),i=this.parser.extractClasses(s),o=this.parser.extractImports(s);return{functions:n.map(r=>this.mapFunction(r)),classes:i.map(r=>this.mapClass(r)),imports:o.map(r=>this.mapImport(r)),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}}},ze=new Q;Pe();var E=1e3;function I(u){let e=u.split(`
|
|
3
3
|
`),t=[],s=[],n="",i=0,o=0,r=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||(i=c+1),n=n?n+" "+d:l;for(let p of d)p==="("?o++:p===")"?o=Math.max(0,o-1):p==="<"?r++:p===">"?r=Math.max(0,r-1):p==="["?a++:p==="]"&&(a=Math.max(0,a-1));o===0&&r===0&&a===0&&(t.push(n),s.push(i),n="")}return n&&(t.push(n),s.push(i)),{logicalLines:t,lineMap:s}}function B(u,e,t="<",s=">"){if(u[e]!==t)return;let n=1,i=e+1;for(;i<u.length&&n>0;)u[i]===t?n++:u[i]===s&&n--,i++;if(n===0)return u.substring(e+1,i-1)}function C(u,e,t){let s=[];for(let n=e-1;n>=0;n--){let i=u[n].trim();if(i.startsWith(t))s.unshift(i);else{if(i===""||i.startsWith("//")||i.startsWith("*")||i.startsWith("#"))continue;break}}return s}function M(u){let e=[],t=0,s="";for(let n of u)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 ce(u){let e=0,t=!1,s="";for(let n=0;n<u.length;n++){let i=u[n];if(t){i===s&&u[n-1]!=="\\"&&(t=!1);continue}i==='"'||i==="'"||i==="`"?(t=!0,s=i):i==="{"?e++:i==="}"&&e--}return e}var Y=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
4
|
`),{logicalLines:n,lineMap:i}=I(e),o=/^(\s*)(async\s+)?def\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*([^:]*\S))?\s*:/;for(let r=0;r<n.length;r++){if(n[r].length>E)continue;let a=n[r].match(o);if(a){let c=a[1].length,l=!!a[2],d=a[3],p=a[4],h=a[5]?.trim(),f=i[r]-1,g=f+1;for(let y=f+1;y<s.length;y++){let x=s[y];if(x.trim()===""||x.trim().startsWith("#"))continue;if((x.match(/^(\s*)/)?.[1].length??0)<=c&&x.trim()!==""){g=y;break}g=y+1}let b=C(s,f,"@");t.push({name:d,parameters:this.parseParams(p),returnType:h,isAsync:l,isPublic:!d.startsWith("_"),complexity:1,decorators:b,genericParams:[],startLine:i[r],endLine:g})}}return t}extractClasses(e){let t=[],s=e.split(`
|
|
5
5
|
`),{logicalLines:n,lineMap:i}=I(e),o=/^(\s*)class\s+(\w+)(?:\(([^)]*)\))?\s*:/;for(let r=0;r<n.length;r++){let a=n[r].match(o);if(a){let c=a[1].length,l=a[2],d=a[3]?a[3].split(",").map(y=>y.trim()):[],p=i[r]-1,h=p+1;for(let y=p+1;y<s.length;y++){let x=s[y];if(x.trim()===""||x.trim().startsWith("#"))continue;if((x.match(/^(\s*)/)?.[1].length??0)<=c&&x.trim()!==""){h=y;break}h=y+1}let f=s.slice(p+1,h).join(`
|
|
@@ -20,7 +20,7 @@ import{d as be}from"./chunk-Z4WAJ647.js";import{a as Le}from"./chunk-2B2RLPK3.js
|
|
|
20
20
|
`),{logicalLines:n,lineMap:i}=I(e),o=/^\s*(public|private|protected|internal)?\s*(suspend)?\s*fun\s+(?:<[^{]*> +)?(\w+)\s*\(([^)]*)\)(?:\s*:\s*([^{=\s]+(?:\s+[^{=\s]+)*))?\s*/,r=0;for(let a=0;a<n.length;a++){let c=n[a];if(c.length>E){r+=(c.match(/\{/g)?.length??0)-(c.match(/\}/g)?.length??0);continue}let l=c.match(o);if(l&&r<=1){let d=l[1]||"public",p=!!l[2],h=l[3],f=l[4],g=l[5]?.trim();if(g&&g.includes("<")){let x=g.indexOf("<"),w=B(g,x);w!==void 0&&(g=g.substring(0,x)+"<"+w+">")}let b=i[a]-1,y=C(s,b,"@");t.push({name:h,parameters:this.parseParams(f),returnType:g,isAsync:p,isPublic:d==="public",complexity:1,decorators:y,genericParams:[],startLine:i[a],endLine:i[a]})}r+=ce(c),r<0&&(r=0)}return t}extractClasses(e){let t=[],s=e.split(`
|
|
21
21
|
`),{logicalLines:n,lineMap:i}=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 r=0;r<n.length;r++){if(n[r].length>E)continue;let a=n[r].match(o);if(a){let c=a[3],l=a[4]?a[4].split(",").map(h=>h.trim().split("(")[0].trim()):[],d=i[r]-1,p=C(s,d,"@");t.push({name:c,methods:[],properties:[],isPublic:(a[1]||"public")==="public",implements:l.slice(1),extends:l[0]||void 0,decorators:p,startLine:i[r],endLine:i[r]})}}return t}extractImports(e){let t=[],s=e.split(`
|
|
22
22
|
`);for(let n of s){let i=n.match(/^\s*import\s+([^\s]+)/);i&&t.push({module:i[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){return e.trim()?M(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(),i=t.substring(s+1).trim(),o=i.indexOf("="),r=o>=0?i.substring(0,o).trim():i,a=o>=0;return{name:n,type:r,isOptional:a||r?.endsWith("?")||!1,defaultValue:void 0}}):[]}},re=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),i=/^\s*([\w<>,.?]+(?:\s+[\w<>,.?]+)*)\s+(\w+)\s*\(([^)]*)\)(?:\s*(async))?\s*\{/;for(let o=0;o<s.length;o++){let r=s[o];if(r.includes(" class ")||r.length>E)continue;let a=r.match(i);if(a){let c=a[1].trim(),l=c;if(c&&c.includes("<")){let f=c.indexOf("<"),g=B(c,f);g!==void 0&&(l=c.substring(0,f)+"<"+g+">")}let d=a[2],p=a[3],h=!!a[4]||l.includes("Future");t.push({name:d,parameters:this.parseParams(p),returnType:l==="void"?void 0:l,isAsync:h,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),i=/^\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 r=s[o].match(i);if(r){let a=r[2],c=r[3],l=r[4]?r[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 i=n.match(/^\s*import\s+'([^']+)'/);i&&t.push({module:i[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return M(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),i=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:i,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},z=ge("ParserRegistry"),xe=["python","java","csharp","rust","swift"],ae=class u{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<u.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),i=this.wasmFailCount>=u.MAX_WASM_RETRIES;z.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${u.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(i?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},oe=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new Y),this.register(new Z),this.register(new ee),this.register(new te),this.register(new se),this.register(new ne),this.register(new ie),this.register(new re),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-RBZWLEVQ.js");if(!e.isWasmAvailable()){z.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 xe){let n=t.get(s),i=this.parsers.get(s);n&&i&&this.parsers.set(s,new ae(n,i))}z.info("tree-sitter WASM parsers available for: "+xe.join(", "))}catch{z.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)}},qe=new oe;import*as S from"node:fs/promises";import*as R from"node:path";var Re=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],Se=[/^\/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],le=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:i=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:r=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let f of Re)if(f.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 f of Se)if(f.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>r)return{valid:!1,error:`Path depth exceeds maximum of ${r}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let f=`.${d.toLowerCase()}`,g=d.toLowerCase();if(o.length>0&&o.some(y=>y.toLowerCase()===f||y.toLowerCase()===g))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(i.length>0&&!i.some(y=>y.toLowerCase()===f||y.toLowerCase()===g))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let p=s?this.joinPathsAbsolute(s,c):c,h=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!p.startsWith(h)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:p,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let i of s)i==="."||i===""||(i===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(i));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}},Me=new le,ve=(u,e)=>Me.validate(u,e);ye();var F=class extends Error{constructor(t,s,n,i){super(t);this.filePath=s;this.code=n;this.cause=i;this.name="FileReadError"}filePath;code;cause},V=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}filePath;cause},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"}requestedPath;issues;riskLevel},de=class{constructor(e,t){this.maxSize=e;this.ttlMs=t}maxSize;ttlMs;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,i)=>{e-n.timestamp>this.ttlMs&&s.push(i)}),s.forEach(n=>{this.delete(n),t++}),t}};function Te(u){let e="",t=0;for(;t<u.length;){let s=u[t],n=u[t+1];s==="*"&&n==="*"?u[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 Ee(u,e,t,s){try{let n=await S.readdir(u,{withFileTypes:!0});for(let i of n){let o=R.join(u,i.name),r=R.relative(s,o);if(i.isDirectory())i.name!=="node_modules"&&!i.name.startsWith(".")&&await Ee(o,e,t,s);else if(i.isFile()){let a=r.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 de(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=R.isAbsolute(e),s=ve(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=R.resolve(this.basePath),i=R.resolve(e);if(!i.startsWith(n))throw new T(e,["Path escapes base directory"],"critical");return i}return s.normalizedPath?s.normalizedPath:t?e:R.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(),P(s);this.stats.cacheMisses++}try{let s=await S.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),P(s)}catch(s){let n=s,i;switch(n.code){case"ENOENT":i="File not found: "+t;break;case"EACCES":i="Permission denied: "+t;break;case"EISDIR":i="Path is a directory: "+t;break;default:i="Failed to read file: "+t}return L(new F(i,t,n.code,n))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=D(t.value);return P(s)}catch(s){let n=s,i=e;try{i=this.resolvePath(e)}catch{}return L(new V("Invalid JSON in file: "+i+" - "+n.message,i,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 S.access(t,S.constants.F_OK),P(!0)}catch(s){let n=s;return n.code==="ENOENT"?P(!1):L(new F("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 S.stat(s)).isDirectory())return L(new F("Base path is not a directory: "+s,s,"ENOTDIR"));let i=Te(e),o=[];return await Ee(s,i,o,s),o.sort(),P(o)}catch(n){let i=n;return L(new F("Failed to list files in: "+s,s,i.code,i))}}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}};J();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 _=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 i=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs);if(!i.ok){let r=await i.text();throw new Error(`Ollama API error (${i.status}): ${r}`)}let o=await i.json();if(o.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${o.embedding.length}`);return o.embedding}catch(i){if(s=A(i),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,i=setTimeout(()=>n.abort(),s);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(i)}}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 Fe}from"crypto";var $=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 Fe("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 i={embedding:s,timestamp:Date.now(),model:t};this.cache.set(n,i)}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[i,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(i),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)}};J();var K=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new _(e.ollamaBaseUrl),this.cache=e.cache??new $(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,i=e.content.trim();if(s.length+i.length>n){let o=n-s.length-3;i=i.substring(0,o)+"..."}return s+i}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=[],i=0,o=0,r=await this.isOllamaAvailable();if(r)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,r);n.push(...d);for(let p of d)p.cached?i++:o++;if(t){let p=c+l.length,h=e.length,g=(Date.now()-s)/p,y=(h-p)*g;t({current:p,total:h,percentage:p/h*100,estimatedTimeRemainingMs:y})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:i,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let r=this.formatForEmbedding(o),a=Date.now(),c=this.cache.get(r,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(r):l=this.generatePseudoEmbedding(r),this.cache.set(r,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}: ${G(l)}`)}}),i=await Promise.all(n);return s.push(...i),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 r=s[o];for(let a=0;a<r.length&&a<t.length;a++)t[(o+a)%t.length]+=r.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,r]of n)o.test(e)&&(t[r]+=.5);let i=Math.sqrt(t.reduce((o,r)=>o+r*r,0))||1;return t.map(o=>o/i)}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}}};J();ye();import{existsSync as Oe,statSync as ke}from"fs";import{dirname as _e,resolve as $e,join as q}from"path";function Ae(u){switch(u){case"ts":case"mts":case"cts":return"tree-sitter-typescript.wasm";case"tsx":return"tree-sitter-tsx.wasm";case"js":case"jsx":case"mjs":case"cjs":return"tree-sitter-javascript.wasm";default:return null}}var U=u=>u.startPosition.row+1,j=(u,e)=>u.childForFieldName(e)?.text??"";function ue(u){for(let e=0;e<u.childCount;e++){let t=u.child(e);if(t){if(t.type==="async")return!0;if(t.type==="function"||t.type==="function_declaration")break}}return!1}function Ne(u){for(let e=0;e<u.childCount;e++)if(u.child(e)?.type==="accessibility_modifier"){let s=u.child(e).text;if(s==="private")return"private";if(s==="protected")return"protected"}return"public"}function De(u){let e=j(u,"name")||"(anonymous)",t=u.childForFieldName("body"),s=[];if(t)for(let n=0;n<t.childCount;n++){let i=t.child(n);i&&i.type==="method_definition"&&s.push({name:j(i,"name"),startLine:U(i),isAsync:ue(i),visibility:Ne(i)})}return{name:e,startLine:U(u),methods:s}}function pe(u){return u.replace(/^['"`]|['"`]$/g,"")}async function me(u,e){let t=Ae(e);if(!t)return null;let s=await be(t);if(!s)return null;let n=null;try{let i=s.parse(u);n=i;let o=i.rootNode;if(!o)return null;let r={functions:[],classes:[],interfaces:[],imports:[]},a=[o];for(;a.length;){let c=a.pop(),l=!0;switch(c.type){case"function_declaration":case"generator_function_declaration":r.functions.push({name:j(c,"name"),startLine:U(c),isAsync:ue(c),visibility:"public"}),l=!1;break;case"class_declaration":case"class":r.classes.push(De(c)),l=!1;break;case"interface_declaration":r.interfaces.push({name:j(c,"name"),startLine:U(c)}),l=!1;break;case"lexical_declaration":case"variable_declaration":{for(let d=0;d<c.childCount;d++){let p=c.child(d);if(!p||p.type!=="variable_declarator")continue;let h=p.childForFieldName("value");if(h&&(h.type==="arrow_function"||h.type==="function"||h.type==="function_expression"))r.functions.push({name:j(p,"name"),startLine:U(p),isAsync:ue(h),visibility:"public"});else if(h&&h.type==="call_expression"&&h.child(0)?.text==="require"){let f=h.childForFieldName("arguments")?.child(1);f&&f.type==="string"&&r.imports.push(pe(f.text))}}l=!1;break}case"import_statement":{let d=c.childForFieldName("source");d&&r.imports.push(pe(d.text)),l=!1;break}case"call_expression":{let d=c.child(0);if(d&&d.text==="require"){let h=c.childForFieldName("arguments")?.child(1);h&&h.type==="string"&&r.imports.push(pe(h.text))}break}}if(l)for(let d=c.childCount-1;d>=0;d--){let p=c.child(d);p&&a.push(p)}}return r}catch{return null}finally{n?.delete?.()}}var Ke={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},he=fe.create("code-intelligence/knowledge-graph"),H=new Set(["ts","tsx","js","jsx"]),Ie=class{config;memory;nodeCache=new Map;edgeIndex=new Map;allEdgesCache;tsParser;fileReader;embedder;llmRouter;constructor(e,t={}){this.config={...Ke,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new N,this.fileReader=new k,this.embedder=new K({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}get nsOpts(){return{namespace:this.config.namespace}}async index(e){let t=Date.now(),s=[],n=0,i=0,o=new Map;try{let{paths:r,incremental:a=!1,includeTests:c=!0,languages:l}=e;a||await this.clear();for(let h of r)try{if(l&&l.length>0){let b=this.getFileExtension(h);if(!this.matchesLanguage(b,l))continue}if(!c&&this.isTestFile(h))continue;let f=this.getFileExtension(h);H.has(f)||o.set(f||"(none)",(o.get(f||"(none)")??0)+1);let g=await this.indexFile(h,a);n+=g.nodes,i+=g.edges}catch(f){s.push({file:h,error:G(f)})}let d=Date.now()-t,p=[];if(o.size>0){let h=Array.from(H).join(", ");for(let[f,g]of o){let b=`${g} file(s) with extension '.${f}' were indexed as plain nodes: no dependency extractor for this language, so 'deps'/'impact' will report 0 edges for them. Supported: ${h}.`;p.push(b),he.warn(b)}}return await this.storeIndexMetadata({filesIndexed:r.length-s.length,nodesCreated:n,edgesCreated:i,duration:d,indexedAt:new Date().toISOString()}),P({filesIndexed:r.length-s.length,nodesCreated:n,edgesCreated:i,duration:d,errors:s,warnings:p})}catch(r){return L(A(r))}}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(A(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,i=[],o=[],r=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,r,i,o,[],a);let c=this.calculateDependencyMetrics(i,o);return P({nodes:i,edges:o,cycles:a,metrics:c})}catch(t){return L(A(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,this.nsOpts);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=await this.loadAllEdges();return this.filterEdgesByDirection(s,e,t)}async loadAllEdges(){if(this.allEdgesCache)return this.allEdgesCache;let e=[],t=`${this.config.namespace}:edge:*`,s=await this.memory.search(t,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let n of s){let i=await this.memory.get(n,this.nsOpts);i&&e.push(i)}return this.allEdgesCache=e,e}async clear(){this.nodeCache.clear(),this.edgeIndex.clear(),this.allEdgesCache=void 0;for(let e of[`${this.config.namespace}:node:`,`${this.config.namespace}:edge:`]){let t=await this.memory.search(`${e}*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let s of t)await this.memory.delete(s,this.nsOpts)}}async removeFileFromGraph(e){let t=this.pathToNodeId(e),s=this.config.namespace,n=await this.memory.search(`${s}:node:${t}*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let o of n)await this.memory.delete(o,this.nsOpts),this.nodeCache.delete(o.slice(`${s}:node:`.length));let i=await this.memory.search(`${s}:edge:*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let o of i){let r=await this.memory.get(o,this.nsOpts);r&&(r.source===t||r.source.startsWith(`${t}:`))&&await this.memory.delete(o,this.nsOpts)}this.edgeIndex.delete(t),this.allEdgesCache=void 0}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){switch(e){case 1:return"claude-haiku-4-5-20251001";case 2:return"claude-sonnet-4-6";case 3:return"claude-sonnet-4-6";case 4:return"claude-opus-4-7";default:return"claude-sonnet-4-6"}}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),i=await this.llmRouter.chat({messages:[{role:"system",content:`You are an expert software architect analyzing code structure. Extract:
|
|
23
|
+
`);for(let n of s){let i=n.match(/^\s*import\s+'([^']+)'/);i&&t.push({module:i[1],namedImports:[],isTypeOnly:!1})}return t}parseParams(e){if(!e.trim())return[];let t=e.replace(/[{}[\]]/g,"");return M(t).map(s=>s.trim()).filter(s=>s).map(s=>{let n=s.replace("required ","").trim().split(/\s+/),i=n[n.length-1]||"",o=n.slice(0,-1).join(" ")||void 0;return{name:i,type:o,isOptional:s.includes("?")||s.includes("{"),defaultValue:void 0}})}},z=ge("ParserRegistry"),xe=["python","java","csharp","rust","swift"],ae=class u{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<u.MAX_WASM_RETRIES)try{return await this.wasmParser.parseFile(e,t)}catch(s){this.wasmFailCount++;let n=s instanceof Error?s.message:String(s),i=this.wasmFailCount>=u.MAX_WASM_RETRIES;z.warn(`[${this.language}] tree-sitter WASM parser failed (attempt ${this.wasmFailCount}/${u.MAX_WASM_RETRIES}): ${n}. Falling back to regex parser (~97-98% accuracy). `+(i?"Set AQE_PARSER_REGEX_ONLY=1 to silence this warning.":"Will retry WASM on next parse."))}return this.regexParser.parseFile(e,t)}},oe=class{parsers=new Map;_wasmInitPromise=null;constructor(){this.register(new Y),this.register(new Z),this.register(new ee),this.register(new te),this.register(new se),this.register(new ne),this.register(new ie),this.register(new re),this._wasmInitPromise=this._tryLoadWasmParsers()}async _tryLoadWasmParsers(){try{let e=await import("./tree-sitter-wasm-parser-EARBJG2H.js");if(!e.isWasmAvailable()){z.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 xe){let n=t.get(s),i=this.parsers.get(s);n&&i&&this.parsers.set(s,new ae(n,i))}z.info("tree-sitter WASM parsers available for: "+xe.join(", "))}catch{z.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)}},qe=new oe;import*as S from"node:fs/promises";import*as R from"node:path";var Re=[/\.\./,/%2e%2e/i,/%252e%252e/i,/\.\.%2f/i,/%2f\.\./i,/\.\.%5c/i,/\.\.\\/,/%c0%ae/i,/%c0%2f/i,/%c1%9c/i,/\0/,/%00/i],Se=[/^\/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],le=class{name="path-traversal";getRiskLevel(){return"critical"}validate(e,t={}){let{basePath:s="",allowAbsolute:n=!1,allowedExtensions:i=[],deniedExtensions:o=[".exe",".bat",".cmd",".sh",".ps1",".dll",".so"],maxDepth:r=10,maxLength:a=4096}=t;if(e.length>a)return{valid:!1,error:`Path exceeds maximum length of ${a}`,riskLevel:"medium"};for(let f of Re)if(f.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 f of Se)if(f.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>r)return{valid:!1,error:`Path depth exceeds maximum of ${r}`,riskLevel:"low"};let d=this.getExtension(c);if(d){let f=`.${d.toLowerCase()}`,g=d.toLowerCase();if(o.length>0&&o.some(y=>y.toLowerCase()===f||y.toLowerCase()===g))return{valid:!1,error:`File extension '${d}' is not allowed`,riskLevel:"high"};if(i.length>0&&!i.some(y=>y.toLowerCase()===f||y.toLowerCase()===g))return{valid:!1,error:`File extension '${d}' is not in allowed list`,riskLevel:"medium"}}let p=s?this.joinPathsAbsolute(s,c):c,h=s.startsWith("/")?`/${this.normalizePath(s)}`:this.normalizePath(s);return s&&!p.startsWith(h)?{valid:!1,error:"Path escapes base directory",riskLevel:"critical"}:{valid:!0,normalizedPath:p,riskLevel:"none"}}normalizePath(e){let t=e.replace(/\\/g,"/");t=t.replace(/\/+/g,"/");let s=t.split("/"),n=[];for(let i of s)i==="."||i===""||(i===".."?n.length>0&&n[n.length-1]!==".."&&n.pop():n.push(i));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}},Me=new le,ve=(u,e)=>Me.validate(u,e);ye();var F=class extends Error{constructor(t,s,n,i){super(t);this.filePath=s;this.code=n;this.cause=i;this.name="FileReadError"}filePath;code;cause},V=class extends Error{constructor(t,s,n){super(t);this.filePath=s;this.cause=n;this.name="JsonParseError"}filePath;cause},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"}requestedPath;issues;riskLevel},de=class{constructor(e,t){this.maxSize=e;this.ttlMs=t}maxSize;ttlMs;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,i)=>{e-n.timestamp>this.ttlMs&&s.push(i)}),s.forEach(n=>{this.delete(n),t++}),t}};function Te(u){let e="",t=0;for(;t<u.length;){let s=u[t],n=u[t+1];s==="*"&&n==="*"?u[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 Ee(u,e,t,s){try{let n=await S.readdir(u,{withFileTypes:!0});for(let i of n){let o=R.join(u,i.name),r=R.relative(s,o);if(i.isDirectory())i.name!=="node_modules"&&!i.name.startsWith(".")&&await Ee(o,e,t,s);else if(i.isFile()){let a=r.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 de(e.maxCacheSize??100,e.cacheTtlMs??300*1e3)}resolvePath(e){let t=R.isAbsolute(e),s=ve(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=R.resolve(this.basePath),i=R.resolve(e);if(!i.startsWith(n))throw new T(e,["Path escapes base directory"],"critical");return i}return s.normalizedPath?s.normalizedPath:t?e:R.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(),P(s);this.stats.cacheMisses++}try{let s=await S.readFile(t,"utf-8");return this.enableCache&&(this.cache.set(t,s,Buffer.byteLength(s,"utf-8")),this.updateCacheStats()),P(s)}catch(s){let n=s,i;switch(n.code){case"ENOENT":i="File not found: "+t;break;case"EACCES":i="Permission denied: "+t;break;case"EISDIR":i="Path is a directory: "+t;break;default:i="Failed to read file: "+t}return L(new F(i,t,n.code,n))}}async readJSON(e){let t=await this.readFile(e);if(!t.success)return t;try{let s=D(t.value);return P(s)}catch(s){let n=s,i=e;try{i=this.resolvePath(e)}catch{}return L(new V("Invalid JSON in file: "+i+" - "+n.message,i,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 S.access(t,S.constants.F_OK),P(!0)}catch(s){let n=s;return n.code==="ENOENT"?P(!1):L(new F("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 S.stat(s)).isDirectory())return L(new F("Base path is not a directory: "+s,s,"ENOTDIR"));let i=Te(e),o=[];return await Ee(s,i,o,s),o.sort(),P(o)}catch(n){let i=n;return L(new F("Failed to list files in: "+s,s,i.code,i))}}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}};J();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 _=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 i=await this.fetchWithTimeout(`${this.baseUrl}/api/embeddings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},this.timeoutMs);if(!i.ok){let r=await i.text();throw new Error(`Ollama API error (${i.status}): ${r}`)}let o=await i.json();if(o.embedding.length!==v.DIMENSIONS)throw new Error(`Invalid embedding dimensions: expected ${v.DIMENSIONS}, got ${o.embedding.length}`);return o.embedding}catch(i){if(s=A(i),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,i=setTimeout(()=>n.abort(),s);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(i)}}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 Fe}from"crypto";var $=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 Fe("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 i={embedding:s,timestamp:Date.now(),model:t};this.cache.set(n,i)}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[i,o]of this.cache.entries())o.timestamp<s&&(this.cache.delete(i),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)}};J();var K=class{client;cache;batchSize;enableFallback;ollamaAvailable=null;constructor(e={}){this.client=new _(e.ollamaBaseUrl),this.cache=e.cache??new $(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,i=e.content.trim();if(s.length+i.length>n){let o=n-s.length-3;i=i.substring(0,o)+"..."}return s+i}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=[],i=0,o=0,r=await this.isOllamaAvailable();if(r)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,r);n.push(...d);for(let p of d)p.cached?i++:o++;if(t){let p=c+l.length,h=e.length,g=(Date.now()-s)/p,y=(h-p)*g;t({current:p,total:h,percentage:p/h*100,estimatedTimeRemainingMs:y})}}let a=Date.now()-s;return{results:n,stats:{totalChunks:e.length,cachedHits:i,computedNew:o,totalTimeMs:a,avgTimePerChunk:a/e.length}}}async processBatch(e,t){let s=[],n=e.map(async o=>{let r=this.formatForEmbedding(o),a=Date.now(),c=this.cache.get(r,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(r):l=this.generatePseudoEmbedding(r),this.cache.set(r,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}: ${G(l)}`)}}),i=await Promise.all(n);return s.push(...i),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 r=s[o];for(let a=0;a<r.length&&a<t.length;a++)t[(o+a)%t.length]+=r.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,r]of n)o.test(e)&&(t[r]+=.5);let i=Math.sqrt(t.reduce((o,r)=>o+r*r,0))||1;return t.map(o=>o/i)}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}}};J();ye();import{existsSync as Oe,statSync as ke}from"fs";import{dirname as _e,resolve as $e,join as q}from"path";function Ae(u){switch(u){case"ts":case"mts":case"cts":return"tree-sitter-typescript.wasm";case"tsx":return"tree-sitter-tsx.wasm";case"js":case"jsx":case"mjs":case"cjs":return"tree-sitter-javascript.wasm";default:return null}}var U=u=>u.startPosition.row+1,j=(u,e)=>u.childForFieldName(e)?.text??"";function ue(u){for(let e=0;e<u.childCount;e++){let t=u.child(e);if(t){if(t.type==="async")return!0;if(t.type==="function"||t.type==="function_declaration")break}}return!1}function Ne(u){for(let e=0;e<u.childCount;e++)if(u.child(e)?.type==="accessibility_modifier"){let s=u.child(e).text;if(s==="private")return"private";if(s==="protected")return"protected"}return"public"}function De(u){let e=j(u,"name")||"(anonymous)",t=u.childForFieldName("body"),s=[];if(t)for(let n=0;n<t.childCount;n++){let i=t.child(n);i&&i.type==="method_definition"&&s.push({name:j(i,"name"),startLine:U(i),isAsync:ue(i),visibility:Ne(i)})}return{name:e,startLine:U(u),methods:s}}function pe(u){return u.replace(/^['"`]|['"`]$/g,"")}async function me(u,e){let t=Ae(e);if(!t)return null;let s=await be(t);if(!s)return null;let n=null;try{let i=s.parse(u);n=i;let o=i.rootNode;if(!o)return null;let r={functions:[],classes:[],interfaces:[],imports:[]},a=[o];for(;a.length;){let c=a.pop(),l=!0;switch(c.type){case"function_declaration":case"generator_function_declaration":r.functions.push({name:j(c,"name"),startLine:U(c),isAsync:ue(c),visibility:"public"}),l=!1;break;case"class_declaration":case"class":r.classes.push(De(c)),l=!1;break;case"interface_declaration":r.interfaces.push({name:j(c,"name"),startLine:U(c)}),l=!1;break;case"lexical_declaration":case"variable_declaration":{for(let d=0;d<c.childCount;d++){let p=c.child(d);if(!p||p.type!=="variable_declarator")continue;let h=p.childForFieldName("value");if(h&&(h.type==="arrow_function"||h.type==="function"||h.type==="function_expression"))r.functions.push({name:j(p,"name"),startLine:U(p),isAsync:ue(h),visibility:"public"});else if(h&&h.type==="call_expression"&&h.child(0)?.text==="require"){let f=h.childForFieldName("arguments")?.child(1);f&&f.type==="string"&&r.imports.push(pe(f.text))}}l=!1;break}case"import_statement":{let d=c.childForFieldName("source");d&&r.imports.push(pe(d.text)),l=!1;break}case"call_expression":{let d=c.child(0);if(d&&d.text==="require"){let h=c.childForFieldName("arguments")?.child(1);h&&h.type==="string"&&r.imports.push(pe(h.text))}break}}if(l)for(let d=c.childCount-1;d>=0;d--){let p=c.child(d);p&&a.push(p)}}return r}catch{return null}finally{n?.delete?.()}}var Ke={maxNodes:1e5,maxEdgesPerNode:500,namespace:"code-intelligence:kg",enableVectorEmbeddings:!0,embeddingDimension:384,enableLLMExtraction:!0,llmModelTier:2,llmMaxTokens:2048},he=fe.create("code-intelligence/knowledge-graph"),H=new Set(["ts","tsx","js","jsx"]),Ie=class{config;memory;nodeCache=new Map;edgeIndex=new Map;allEdgesCache;tsParser;fileReader;embedder;llmRouter;constructor(e,t={}){this.config={...Ke,...t},this.isKnowledgeGraphDependencies(e)?(this.memory=e.memory,this.llmRouter=e.llmRouter):(this.memory=e,this.llmRouter=void 0),this.tsParser=new N,this.fileReader=new k,this.embedder=new K({enableFallback:!0})}isKnowledgeGraphDependencies(e){return e.memory!==void 0}get nsOpts(){return{namespace:this.config.namespace}}async index(e){let t=Date.now(),s=[],n=0,i=0,o=new Map;try{let{paths:r,incremental:a=!1,includeTests:c=!0,languages:l}=e;a||await this.clear();for(let h of r)try{if(l&&l.length>0){let b=this.getFileExtension(h);if(!this.matchesLanguage(b,l))continue}if(!c&&this.isTestFile(h))continue;let f=this.getFileExtension(h);H.has(f)||o.set(f||"(none)",(o.get(f||"(none)")??0)+1);let g=await this.indexFile(h,a);n+=g.nodes,i+=g.edges}catch(f){s.push({file:h,error:G(f)})}let d=Date.now()-t,p=[];if(o.size>0){let h=Array.from(H).join(", ");for(let[f,g]of o){let b=`${g} file(s) with extension '.${f}' were indexed as plain nodes: no dependency extractor for this language, so 'deps'/'impact' will report 0 edges for them. Supported: ${h}.`;p.push(b),he.warn(b)}}return await this.storeIndexMetadata({filesIndexed:r.length-s.length,nodesCreated:n,edgesCreated:i,duration:d,indexedAt:new Date().toISOString()}),P({filesIndexed:r.length-s.length,nodesCreated:n,edgesCreated:i,duration:d,errors:s,warnings:p})}catch(r){return L(A(r))}}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(A(t))}}async mapDependencies(e){try{let{files:t,direction:s,depth:n=3}=e,i=[],o=[],r=new Set,a=[];for(let l of t)await this.traverseDependencies(l,s,n,r,i,o,[],a);let c=this.calculateDependencyMetrics(i,o);return P({nodes:i,edges:o,cycles:a,metrics:c})}catch(t){return L(A(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,this.nsOpts);return s&&this.nodeCache.set(e,s),s}async getEdges(e,t){let s=await this.loadAllEdges();return this.filterEdgesByDirection(s,e,t)}async loadAllEdges(){if(this.allEdgesCache)return this.allEdgesCache;let e=[],t=`${this.config.namespace}:edge:*`,s=await this.memory.search(t,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let n of s){let i=await this.memory.get(n,this.nsOpts);i&&e.push(i)}return this.allEdgesCache=e,e}async clear(){this.nodeCache.clear(),this.edgeIndex.clear(),this.allEdgesCache=void 0;for(let e of[`${this.config.namespace}:node:`,`${this.config.namespace}:edge:`]){let t=await this.memory.search(`${e}*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let s of t)await this.memory.delete(s,this.nsOpts)}}async removeFileFromGraph(e){let t=this.pathToNodeId(e),s=this.config.namespace,n=await this.memory.search(`${s}:node:${t}*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let o of n)await this.memory.delete(o,this.nsOpts),this.nodeCache.delete(o.slice(`${s}:node:`.length));let i=await this.memory.search(`${s}:edge:*`,Number.MAX_SAFE_INTEGER,this.nsOpts);for(let o of i){let r=await this.memory.get(o,this.nsOpts);r&&(r.source===t||r.source.startsWith(`${t}:`))&&await this.memory.delete(o,this.nsOpts)}this.edgeIndex.delete(t),this.allEdgesCache=void 0}isLLMExtractionAvailable(){return this.config.enableLLMExtraction===!0&&this.llmRouter!==void 0}getModelForTier(e){switch(e){case 1:return"claude-haiku-4-5-20251001";case 2:return"claude-sonnet-4-6";case 3:return"claude-sonnet-4-6";case 4:return"claude-opus-4-7";default:return"claude-sonnet-4-6"}}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),i=await this.llmRouter.chat({messages:[{role:"system",content:`You are an expert software architect analyzing code structure. Extract:
|
|
24
24
|
1. Semantic relationships between code entities (inheritance, composition, dependency, collaboration)
|
|
25
25
|
2. Design patterns used (Factory, Singleton, Observer, Strategy, etc.)
|
|
26
26
|
3. Architectural boundaries (layers, modules, domains)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{c as t}from"./chunk-
|
|
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.11.0");process.exit(0)}
|
|
2
|
+
import{c as t}from"./chunk-ACV2WVMX.js";function o(e){try{return e.prepare(`
|
|
3
3
|
SELECT COUNT(*) as count FROM sqlite_master
|
|
4
4
|
WHERE type='table' AND name IN ('hypergraph_nodes', 'hypergraph_edges')
|
|
5
5
|
`).get().count===2}catch{return!1}}var r,a,E,n,p=t(()=>{"use strict";r=`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.
|
|
2
|
-
import{c as T}from"./chunk-
|
|
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.11.0");process.exit(0)}
|
|
2
|
+
import{c as T}from"./chunk-ACV2WVMX.js";var S,E,t,N,_=T(()=>{"use strict";S={MMAP_SIZE_BYTES:67108864,CACHE_SIZE_KB:-32e3,BUSY_TIMEOUT_MS:5e3,DEFAULT_VECTOR_DIMENSIONS:384,DEFAULT_SEARCH_LIMIT:100,CLEANUP_INTERVAL_MS:6e4,TTL_MULTIPLIER_MS:1e3},E={M_CONNECTIONS:16,EF_CONSTRUCTION:200,EF_SEARCH:100,DEFAULT_K_NEIGHBORS:10,COVERAGE_VECTOR_DIMENSION:384},t={MAX_CONCURRENT_AGENTS:15,DEFAULT_AGENT_TTL_MS:36e5,DEFAULT_AGENT_TIMEOUT_MS:12e4,MAX_POOL_SIZE:10},N={MAX_HISTORY_SIZE:1e4}});export{S as a,E as b,t as c,N as d,_ as e};
|