just-bash 2.9.4 → 2.9.6
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/dist/AGENTS.md +31 -2
- package/dist/Bash.d.ts +7 -1
- package/dist/bin/chunks/alias-3GODYSFD.js +2 -0
- package/dist/bin/chunks/awk2-PWEGD656.js +2 -0
- package/dist/bin/chunks/base64-YXBFJFHG.js +2 -0
- package/dist/bin/chunks/basename-KBUKWB2E.js +2 -0
- package/dist/bin/chunks/bash-RJTQJAKW.js +2 -0
- package/dist/bin/chunks/cat-3J7U3HHI.js +2 -0
- package/dist/bin/chunks/chmod-4O2C4V42.js +2 -0
- package/dist/bin/chunks/chunk-26NO42TF.js +14 -0
- package/dist/bin/chunks/chunk-2SIXTZCJ.js +5 -0
- package/dist/bin/chunks/chunk-3MBAUIBB.js +7 -0
- package/dist/bin/chunks/chunk-3Y32LPNT.js +2 -0
- package/dist/bin/chunks/chunk-4E3LY6YK.js +10 -0
- package/dist/bin/chunks/chunk-4P5OA25Z.js +26 -0
- package/dist/bin/chunks/chunk-4PS5JJDT.js +8 -0
- package/dist/bin/chunks/chunk-5G2VOPPJ.js +7 -0
- package/dist/bin/chunks/chunk-5U7Q4GUC.js +6 -0
- package/dist/bin/chunks/chunk-5VFN7VVJ.js +9 -0
- package/dist/bin/chunks/chunk-6VUEI2GS.js +9 -0
- package/dist/bin/chunks/chunk-7BORMNPQ.js +2 -0
- package/dist/bin/chunks/chunk-7ECKLAVW.js +11 -0
- package/dist/bin/chunks/chunk-A4442AOC.js +6 -0
- package/dist/bin/chunks/chunk-BARKRZDC.js +6 -0
- package/dist/bin/chunks/{tr-IAUNBQKH.js → chunk-BDSRLH5T.js} +5 -5
- package/dist/bin/chunks/chunk-BYDV4VEF.js +3 -0
- package/dist/bin/{shell/chunks/yq-XD7UYY5C.js → chunks/chunk-CHB75QIN.js} +24 -24
- package/dist/bin/chunks/chunk-D2GFNFUN.js +7 -0
- package/dist/bin/chunks/chunk-DAGNL3F2.js +32 -0
- package/dist/bin/chunks/{tar-CLEBMI4R.js → chunk-EFX3F2HZ.js} +6 -6
- package/dist/bin/chunks/{rmdir-OEMA5ZTD.js → chunk-EJQKHROT.js} +3 -3
- package/dist/bin/chunks/chunk-EUXCM6C4.js +12 -0
- package/dist/bin/{shell/chunks/sed-E4QAUCYQ.js → chunks/chunk-FEBB4TFH.js} +36 -36
- package/dist/bin/chunks/chunk-FLPVVSN5.js +5 -0
- package/dist/bin/chunks/chunk-ITA43A73.js +7 -0
- package/dist/bin/chunks/chunk-IY3BUFJK.js +5 -0
- package/dist/bin/chunks/chunk-JLX6YWGA.js +3 -0
- package/dist/bin/chunks/chunk-JQBC3FXE.js +8 -0
- package/dist/bin/chunks/chunk-JTF74J6E.js +2 -0
- package/dist/bin/chunks/chunk-JXC25GVQ.js +5 -0
- package/dist/bin/chunks/chunk-K47SEEPI.js +6 -0
- package/dist/bin/chunks/chunk-K7XSYP4L.js +21 -0
- package/dist/bin/chunks/chunk-KLMOJKL4.js +16 -0
- package/dist/bin/chunks/chunk-KWLLB7S3.js +7 -0
- package/dist/bin/chunks/chunk-LJKIWB5F.js +4 -0
- package/dist/bin/chunks/chunk-LMK6G2HH.js +8 -0
- package/dist/bin/chunks/{chunk-B3E7BBYK.js → chunk-LS25HZNJ.js} +41 -41
- package/dist/bin/chunks/chunk-MAVV76T4.js +2 -0
- package/dist/bin/{shell/chunks/xan-QLNZCWIG.js → chunks/chunk-MNNOATCV.js} +17 -17
- package/dist/bin/chunks/chunk-N43DJTSI.js +2 -0
- package/dist/bin/chunks/{file-MWSA2WYI.js → chunk-N5OTVT4F.js} +1 -1
- package/dist/bin/chunks/{time-F4NVQOJH.js → chunk-N73TVRMN.js} +5 -5
- package/dist/bin/chunks/chunk-NEQEZ32M.js +5 -0
- package/dist/bin/chunks/{sleep-O5BOTJGJ.js → chunk-NFZDITRV.js} +4 -4
- package/dist/bin/chunks/chunk-NSUMEERA.js +12 -0
- package/dist/bin/chunks/chunk-OIKCUTTB.js +6 -0
- package/dist/bin/chunks/chunk-P6GNZPVW.js +19 -0
- package/dist/bin/chunks/chunk-P7UCWJ33.js +12 -0
- package/dist/bin/chunks/{sqlite3-CUDCXXK3.js → chunk-PDVXLMUU.js} +9 -9
- package/dist/bin/chunks/chunk-PPBQJBC2.js +5 -0
- package/dist/bin/chunks/chunk-PQNTKMH3.js +6 -0
- package/dist/bin/chunks/chunk-PS4LOXE5.js +8 -0
- package/dist/bin/{shell/chunks/rg-IZR5557M.js → chunks/chunk-Q4QFIAHB.js} +9 -9
- package/dist/bin/chunks/chunk-QEBPVWVB.js +13 -0
- package/dist/bin/chunks/chunk-QXB5WI2V.js +16 -0
- package/dist/bin/chunks/chunk-RJSAGJQJ.js +11 -0
- package/dist/bin/chunks/chunk-ROJPSS6N.js +3 -0
- package/dist/bin/chunks/chunk-RT7TRQVZ.js +3 -0
- package/dist/bin/chunks/chunk-S7OHMN3F.js +6 -0
- package/dist/bin/chunks/{nl-DSM3NUGM.js → chunk-SGA7Y45Z.js} +7 -7
- package/dist/bin/chunks/chunk-SXRVLCZ4.js +2 -0
- package/dist/bin/chunks/chunk-TEFXEYX3.js +3 -0
- package/dist/bin/chunks/chunk-THALLNXT.js +7 -0
- package/dist/bin/chunks/chunk-THLAHQXV.js +16 -0
- package/dist/bin/chunks/chunk-TIDZOIPX.js +3 -0
- package/dist/bin/chunks/chunk-VNER2XXL.js +7 -0
- package/dist/bin/chunks/chunk-W2FKF3MM.js +9 -0
- package/dist/bin/chunks/chunk-WT2HWDDA.js +9 -0
- package/dist/bin/chunks/chunk-X2I3PJTX.js +15 -0
- package/dist/bin/chunks/chunk-XAL6VWGA.js +9 -0
- package/dist/bin/chunks/{html-to-markdown-EPEXKI4B.js → chunk-XKPFI566.js} +9 -9
- package/dist/bin/chunks/chunk-YEKSVVRC.js +11 -0
- package/dist/bin/chunks/chunk-YLE2OYY6.js +2 -0
- package/dist/bin/chunks/chunk-YYQ22ZRL.js +8 -0
- package/dist/bin/chunks/chunk-ZA4HUKJ3.js +13 -0
- package/dist/bin/chunks/chunk-ZKC5HQYO.js +14 -0
- package/dist/bin/chunks/clear-KRGKPFOI.js +2 -0
- package/dist/bin/chunks/column-XGV32UPN.js +2 -0
- package/dist/bin/chunks/comm-R3F3Z5DX.js +2 -0
- package/dist/bin/chunks/cp-XH2ZB7WT.js +2 -0
- package/dist/bin/chunks/cut-HDHQDWRG.js +2 -0
- package/dist/bin/chunks/date-6VDN5QZ5.js +2 -0
- package/dist/bin/chunks/diff-LE7GMFZD.js +2 -0
- package/dist/bin/chunks/dirname-5FAOMLBL.js +2 -0
- package/dist/bin/chunks/du-66BNA4IN.js +2 -0
- package/dist/bin/chunks/echo-2MUAOGUE.js +2 -0
- package/dist/bin/chunks/env-EVLPSWFF.js +2 -0
- package/dist/bin/chunks/expand-26XPP5KB.js +2 -0
- package/dist/bin/{shell/chunks/expansion-LR5H7O2U.js → chunks/expansion-TL4Q62VX.js} +1 -1
- package/dist/bin/chunks/expr-MLHUWFYI.js +2 -0
- package/dist/bin/chunks/file-D5YKS5NV.js +2 -0
- package/dist/bin/chunks/find-K777TRNA.js +2 -0
- package/dist/bin/chunks/flag-coverage-GELILQAH.js +2 -0
- package/dist/bin/chunks/fold-XSVNTAWH.js +2 -0
- package/dist/bin/chunks/grep-FRIPZKKT.js +2 -0
- package/dist/bin/chunks/gzip-EENEW6WQ.js +2 -0
- package/dist/bin/chunks/head-YMNRW3F3.js +2 -0
- package/dist/bin/chunks/help-JF5TTAKQ.js +2 -0
- package/dist/bin/chunks/history-UUKG55YW.js +2 -0
- package/dist/bin/chunks/hostname-WY6RKE32.js +2 -0
- package/dist/bin/chunks/html-to-markdown-WVZA3MCP.js +2 -0
- package/dist/bin/chunks/join-Y4Q5WVVE.js +2 -0
- package/dist/bin/chunks/jq-CXQ33VMW.js +2 -0
- package/dist/bin/chunks/ln-5TCJXDGY.js +2 -0
- package/dist/bin/chunks/ls-ZXYOL67L.js +2 -0
- package/dist/bin/chunks/md5sum-NCLXV2S3.js +2 -0
- package/dist/bin/chunks/mkdir-6OKMS3KO.js +2 -0
- package/dist/bin/chunks/mv-OY7X62QC.js +2 -0
- package/dist/bin/chunks/nl-XH3L75DR.js +2 -0
- package/dist/bin/chunks/od-52FBC34W.js +2 -0
- package/dist/bin/chunks/paste-3UVLMQ2K.js +2 -0
- package/dist/bin/chunks/printf-TZC5BRAY.js +2 -0
- package/dist/bin/chunks/pwd-6VBAPL3Y.js +2 -0
- package/dist/bin/chunks/readlink-YNOUXNUY.js +2 -0
- package/dist/bin/chunks/rev-UHEPS2UL.js +2 -0
- package/dist/bin/chunks/rg-3R5G2XL4.js +2 -0
- package/dist/bin/chunks/rm-5QIBTLJG.js +2 -0
- package/dist/bin/chunks/rmdir-5KLM4EA6.js +2 -0
- package/dist/bin/chunks/sed-WNL6TIIN.js +2 -0
- package/dist/bin/chunks/seq-V7KBLSQ7.js +2 -0
- package/dist/bin/chunks/sha1sum-BHNJ5ALF.js +2 -0
- package/dist/bin/chunks/sha256sum-HJJ3NJ5L.js +2 -0
- package/dist/bin/chunks/sleep-PICQVS6Q.js +2 -0
- package/dist/bin/chunks/sort-NZSEYCI6.js +2 -0
- package/dist/bin/chunks/split-NOZ7FFXW.js +2 -0
- package/dist/bin/chunks/sqlite3-4SEIR46P.js +2 -0
- package/dist/bin/chunks/stat-XH7E4E2C.js +2 -0
- package/dist/bin/chunks/strings-XXKZCWY5.js +2 -0
- package/dist/bin/chunks/tac-TZBNTR4K.js +2 -0
- package/dist/bin/chunks/tail-V537TDFR.js +2 -0
- package/dist/bin/chunks/tar-7B5KH3QG.js +2 -0
- package/dist/bin/chunks/tee-HK2SYCAR.js +2 -0
- package/dist/bin/chunks/time-4C3A4THJ.js +2 -0
- package/dist/bin/chunks/timeout-RS7REDYT.js +2 -0
- package/dist/bin/chunks/touch-DWKSZGOQ.js +2 -0
- package/dist/bin/chunks/tr-GDDRKGRB.js +2 -0
- package/dist/bin/chunks/tree-HEKABARE.js +2 -0
- package/dist/bin/chunks/true-DP5UZP52.js +2 -0
- package/dist/bin/chunks/unexpand-OYZ7KOYR.js +2 -0
- package/dist/bin/chunks/uniq-FZWFZEN5.js +2 -0
- package/dist/bin/chunks/wc-ZIV3TFVG.js +2 -0
- package/dist/bin/chunks/which-67WZ6OMV.js +2 -0
- package/dist/bin/chunks/whoami-E7PN2UWC.js +2 -0
- package/dist/bin/chunks/xan-FMSZPFX4.js +2 -0
- package/dist/bin/chunks/xargs-YWPEV2QC.js +2 -0
- package/dist/bin/chunks/yq-WUJ5JNDT.js +2 -0
- package/dist/bin/just-bash.js +200 -198
- package/dist/bin/shell/chunks/alias-3GODYSFD.js +2 -0
- package/dist/bin/shell/chunks/awk2-PWEGD656.js +2 -0
- package/dist/bin/shell/chunks/base64-YXBFJFHG.js +2 -0
- package/dist/bin/shell/chunks/basename-KBUKWB2E.js +2 -0
- package/dist/bin/shell/chunks/bash-RJTQJAKW.js +2 -0
- package/dist/bin/shell/chunks/cat-3J7U3HHI.js +2 -0
- package/dist/bin/shell/chunks/chmod-4O2C4V42.js +2 -0
- package/dist/bin/shell/chunks/chunk-26NO42TF.js +14 -0
- package/dist/bin/shell/chunks/chunk-2SIXTZCJ.js +5 -0
- package/dist/bin/shell/chunks/chunk-3MBAUIBB.js +7 -0
- package/dist/bin/shell/chunks/chunk-3Y32LPNT.js +2 -0
- package/dist/bin/shell/chunks/chunk-4E3LY6YK.js +10 -0
- package/dist/bin/shell/chunks/chunk-4P5OA25Z.js +26 -0
- package/dist/bin/shell/chunks/chunk-4PS5JJDT.js +8 -0
- package/dist/bin/shell/chunks/chunk-5G2VOPPJ.js +7 -0
- package/dist/bin/shell/chunks/chunk-5U7Q4GUC.js +6 -0
- package/dist/bin/shell/chunks/chunk-5VFN7VVJ.js +9 -0
- package/dist/bin/shell/chunks/chunk-6VUEI2GS.js +9 -0
- package/dist/bin/shell/chunks/chunk-7BORMNPQ.js +2 -0
- package/dist/bin/shell/chunks/chunk-7ECKLAVW.js +11 -0
- package/dist/bin/shell/chunks/chunk-A4442AOC.js +6 -0
- package/dist/bin/shell/chunks/chunk-BARKRZDC.js +6 -0
- package/dist/bin/shell/chunks/{tr-IAUNBQKH.js → chunk-BDSRLH5T.js} +5 -5
- package/dist/bin/shell/chunks/chunk-BYDV4VEF.js +3 -0
- package/dist/bin/{chunks/yq-XD7UYY5C.js → shell/chunks/chunk-CHB75QIN.js} +24 -24
- package/dist/bin/shell/chunks/chunk-D2GFNFUN.js +7 -0
- package/dist/bin/shell/chunks/chunk-DAGNL3F2.js +32 -0
- package/dist/bin/shell/chunks/{tar-CLEBMI4R.js → chunk-EFX3F2HZ.js} +6 -6
- package/dist/bin/shell/chunks/{rmdir-OEMA5ZTD.js → chunk-EJQKHROT.js} +3 -3
- package/dist/bin/shell/chunks/chunk-EUXCM6C4.js +12 -0
- package/dist/bin/{chunks/sed-E4QAUCYQ.js → shell/chunks/chunk-FEBB4TFH.js} +36 -36
- package/dist/bin/shell/chunks/chunk-FLPVVSN5.js +5 -0
- package/dist/bin/shell/chunks/chunk-ITA43A73.js +7 -0
- package/dist/bin/shell/chunks/chunk-IY3BUFJK.js +5 -0
- package/dist/bin/shell/chunks/chunk-JLX6YWGA.js +3 -0
- package/dist/bin/shell/chunks/chunk-JQBC3FXE.js +8 -0
- package/dist/bin/shell/chunks/chunk-JTF74J6E.js +2 -0
- package/dist/bin/shell/chunks/chunk-JXC25GVQ.js +5 -0
- package/dist/bin/shell/chunks/chunk-K47SEEPI.js +6 -0
- package/dist/bin/shell/chunks/chunk-K7XSYP4L.js +21 -0
- package/dist/bin/shell/chunks/chunk-KLMOJKL4.js +16 -0
- package/dist/bin/shell/chunks/chunk-KWLLB7S3.js +7 -0
- package/dist/bin/shell/chunks/chunk-LJKIWB5F.js +4 -0
- package/dist/bin/shell/chunks/chunk-LMK6G2HH.js +8 -0
- package/dist/bin/shell/chunks/{chunk-B3E7BBYK.js → chunk-LS25HZNJ.js} +41 -41
- package/dist/bin/shell/chunks/chunk-MAVV76T4.js +2 -0
- package/dist/bin/{chunks/xan-QLNZCWIG.js → shell/chunks/chunk-MNNOATCV.js} +17 -17
- package/dist/bin/shell/chunks/chunk-N43DJTSI.js +2 -0
- package/dist/bin/shell/chunks/{file-MWSA2WYI.js → chunk-N5OTVT4F.js} +1 -1
- package/dist/bin/shell/chunks/{time-F4NVQOJH.js → chunk-N73TVRMN.js} +5 -5
- package/dist/bin/shell/chunks/chunk-NEQEZ32M.js +5 -0
- package/dist/bin/shell/chunks/{sleep-O5BOTJGJ.js → chunk-NFZDITRV.js} +4 -4
- package/dist/bin/shell/chunks/chunk-NSUMEERA.js +12 -0
- package/dist/bin/shell/chunks/chunk-OIKCUTTB.js +6 -0
- package/dist/bin/shell/chunks/chunk-P6GNZPVW.js +19 -0
- package/dist/bin/shell/chunks/chunk-P7UCWJ33.js +12 -0
- package/dist/bin/shell/chunks/{sqlite3-CUDCXXK3.js → chunk-PDVXLMUU.js} +9 -9
- package/dist/bin/shell/chunks/chunk-PPBQJBC2.js +5 -0
- package/dist/bin/shell/chunks/chunk-PQNTKMH3.js +6 -0
- package/dist/bin/shell/chunks/chunk-PS4LOXE5.js +8 -0
- package/dist/bin/{chunks/rg-IZR5557M.js → shell/chunks/chunk-Q4QFIAHB.js} +9 -9
- package/dist/bin/shell/chunks/chunk-QEBPVWVB.js +13 -0
- package/dist/bin/shell/chunks/chunk-QXB5WI2V.js +16 -0
- package/dist/bin/shell/chunks/chunk-RJSAGJQJ.js +11 -0
- package/dist/bin/shell/chunks/chunk-ROJPSS6N.js +3 -0
- package/dist/bin/shell/chunks/chunk-RT7TRQVZ.js +3 -0
- package/dist/bin/shell/chunks/chunk-S7OHMN3F.js +6 -0
- package/dist/bin/shell/chunks/{nl-DSM3NUGM.js → chunk-SGA7Y45Z.js} +7 -7
- package/dist/bin/shell/chunks/chunk-SXRVLCZ4.js +2 -0
- package/dist/bin/shell/chunks/chunk-TEFXEYX3.js +3 -0
- package/dist/bin/shell/chunks/chunk-THALLNXT.js +7 -0
- package/dist/bin/shell/chunks/chunk-THLAHQXV.js +16 -0
- package/dist/bin/shell/chunks/chunk-TIDZOIPX.js +3 -0
- package/dist/bin/shell/chunks/chunk-VNER2XXL.js +7 -0
- package/dist/bin/shell/chunks/chunk-W2FKF3MM.js +9 -0
- package/dist/bin/shell/chunks/chunk-WT2HWDDA.js +9 -0
- package/dist/bin/shell/chunks/chunk-X2I3PJTX.js +15 -0
- package/dist/bin/shell/chunks/chunk-XAL6VWGA.js +9 -0
- package/dist/bin/shell/chunks/{html-to-markdown-EPEXKI4B.js → chunk-XKPFI566.js} +9 -9
- package/dist/bin/shell/chunks/chunk-YEKSVVRC.js +11 -0
- package/dist/bin/shell/chunks/chunk-YLE2OYY6.js +2 -0
- package/dist/bin/shell/chunks/chunk-YYQ22ZRL.js +8 -0
- package/dist/bin/shell/chunks/chunk-ZA4HUKJ3.js +13 -0
- package/dist/bin/shell/chunks/chunk-ZKC5HQYO.js +14 -0
- package/dist/bin/shell/chunks/clear-KRGKPFOI.js +2 -0
- package/dist/bin/shell/chunks/column-XGV32UPN.js +2 -0
- package/dist/bin/shell/chunks/comm-R3F3Z5DX.js +2 -0
- package/dist/bin/shell/chunks/cp-XH2ZB7WT.js +2 -0
- package/dist/bin/shell/chunks/cut-HDHQDWRG.js +2 -0
- package/dist/bin/shell/chunks/date-6VDN5QZ5.js +2 -0
- package/dist/bin/shell/chunks/diff-LE7GMFZD.js +2 -0
- package/dist/bin/shell/chunks/dirname-5FAOMLBL.js +2 -0
- package/dist/bin/shell/chunks/du-66BNA4IN.js +2 -0
- package/dist/bin/shell/chunks/echo-2MUAOGUE.js +2 -0
- package/dist/bin/shell/chunks/env-EVLPSWFF.js +2 -0
- package/dist/bin/shell/chunks/expand-26XPP5KB.js +2 -0
- package/dist/bin/{chunks/expansion-LR5H7O2U.js → shell/chunks/expansion-TL4Q62VX.js} +1 -1
- package/dist/bin/shell/chunks/expr-MLHUWFYI.js +2 -0
- package/dist/bin/shell/chunks/file-D5YKS5NV.js +2 -0
- package/dist/bin/shell/chunks/find-K777TRNA.js +2 -0
- package/dist/bin/shell/chunks/flag-coverage-GELILQAH.js +2 -0
- package/dist/bin/shell/chunks/fold-XSVNTAWH.js +2 -0
- package/dist/bin/shell/chunks/grep-FRIPZKKT.js +2 -0
- package/dist/bin/shell/chunks/gzip-EENEW6WQ.js +2 -0
- package/dist/bin/shell/chunks/head-YMNRW3F3.js +2 -0
- package/dist/bin/shell/chunks/help-JF5TTAKQ.js +2 -0
- package/dist/bin/shell/chunks/history-UUKG55YW.js +2 -0
- package/dist/bin/shell/chunks/hostname-WY6RKE32.js +2 -0
- package/dist/bin/shell/chunks/html-to-markdown-WVZA3MCP.js +2 -0
- package/dist/bin/shell/chunks/join-Y4Q5WVVE.js +2 -0
- package/dist/bin/shell/chunks/jq-CXQ33VMW.js +2 -0
- package/dist/bin/shell/chunks/ln-5TCJXDGY.js +2 -0
- package/dist/bin/shell/chunks/ls-ZXYOL67L.js +2 -0
- package/dist/bin/shell/chunks/md5sum-NCLXV2S3.js +2 -0
- package/dist/bin/shell/chunks/mkdir-6OKMS3KO.js +2 -0
- package/dist/bin/shell/chunks/mv-OY7X62QC.js +2 -0
- package/dist/bin/shell/chunks/nl-XH3L75DR.js +2 -0
- package/dist/bin/shell/chunks/od-52FBC34W.js +2 -0
- package/dist/bin/shell/chunks/paste-3UVLMQ2K.js +2 -0
- package/dist/bin/shell/chunks/printf-TZC5BRAY.js +2 -0
- package/dist/bin/shell/chunks/pwd-6VBAPL3Y.js +2 -0
- package/dist/bin/shell/chunks/readlink-YNOUXNUY.js +2 -0
- package/dist/bin/shell/chunks/rev-UHEPS2UL.js +2 -0
- package/dist/bin/shell/chunks/rg-3R5G2XL4.js +2 -0
- package/dist/bin/shell/chunks/rm-5QIBTLJG.js +2 -0
- package/dist/bin/shell/chunks/rmdir-5KLM4EA6.js +2 -0
- package/dist/bin/shell/chunks/sed-WNL6TIIN.js +2 -0
- package/dist/bin/shell/chunks/seq-V7KBLSQ7.js +2 -0
- package/dist/bin/shell/chunks/sha1sum-BHNJ5ALF.js +2 -0
- package/dist/bin/shell/chunks/sha256sum-HJJ3NJ5L.js +2 -0
- package/dist/bin/shell/chunks/sleep-PICQVS6Q.js +2 -0
- package/dist/bin/shell/chunks/sort-NZSEYCI6.js +2 -0
- package/dist/bin/shell/chunks/split-NOZ7FFXW.js +2 -0
- package/dist/bin/shell/chunks/sqlite3-4SEIR46P.js +2 -0
- package/dist/bin/shell/chunks/stat-XH7E4E2C.js +2 -0
- package/dist/bin/shell/chunks/strings-XXKZCWY5.js +2 -0
- package/dist/bin/shell/chunks/tac-TZBNTR4K.js +2 -0
- package/dist/bin/shell/chunks/tail-V537TDFR.js +2 -0
- package/dist/bin/shell/chunks/tar-7B5KH3QG.js +2 -0
- package/dist/bin/shell/chunks/tee-HK2SYCAR.js +2 -0
- package/dist/bin/shell/chunks/time-4C3A4THJ.js +2 -0
- package/dist/bin/shell/chunks/timeout-RS7REDYT.js +2 -0
- package/dist/bin/shell/chunks/touch-DWKSZGOQ.js +2 -0
- package/dist/bin/shell/chunks/tr-GDDRKGRB.js +2 -0
- package/dist/bin/shell/chunks/tree-HEKABARE.js +2 -0
- package/dist/bin/shell/chunks/true-DP5UZP52.js +2 -0
- package/dist/bin/shell/chunks/unexpand-OYZ7KOYR.js +2 -0
- package/dist/bin/shell/chunks/uniq-FZWFZEN5.js +2 -0
- package/dist/bin/shell/chunks/wc-ZIV3TFVG.js +2 -0
- package/dist/bin/shell/chunks/which-67WZ6OMV.js +2 -0
- package/dist/bin/shell/chunks/whoami-E7PN2UWC.js +2 -0
- package/dist/bin/shell/chunks/xan-FMSZPFX4.js +2 -0
- package/dist/bin/shell/chunks/xargs-YWPEV2QC.js +2 -0
- package/dist/bin/shell/chunks/yq-WUJ5JNDT.js +2 -0
- package/dist/bin/shell/shell.js +192 -190
- package/dist/bundle/browser.js +640 -638
- package/dist/bundle/chunks/alias-JE7RI5QX.js +1 -0
- package/dist/bundle/chunks/awk2-BDPR2JPZ.js +1 -0
- package/dist/bundle/chunks/base64-A3SGWC34.js +1 -0
- package/dist/bundle/chunks/basename-AA2KJYZQ.js +1 -0
- package/dist/bundle/chunks/bash-OVBCDR7G.js +1 -0
- package/dist/bundle/chunks/cat-C2OBLGHA.js +1 -0
- package/dist/bundle/chunks/chmod-MIKE3OIT.js +1 -0
- package/dist/bundle/chunks/chunk-27LMNKBP.js +7 -0
- package/dist/bundle/chunks/chunk-2OCD45J4.js +12 -0
- package/dist/bundle/chunks/chunk-3KWUDRIP.js +20 -0
- package/dist/bundle/chunks/chunk-4HHKTUW3.js +2 -0
- package/dist/bundle/chunks/chunk-4Q4SM6WR.js +4 -0
- package/dist/bundle/chunks/chunk-55VFSPNA.js +2 -0
- package/dist/bundle/chunks/chunk-5V6VZH6T.js +1 -0
- package/dist/bundle/chunks/chunk-64BAICW3.js +1 -0
- package/dist/bundle/chunks/chunk-6NY2AP72.js +5 -0
- package/dist/bundle/chunks/chunk-7C6RBHP3.js +4 -0
- package/dist/bundle/chunks/chunk-7DBA735O.js +5 -0
- package/dist/bundle/chunks/chunk-A4HU7SVR.js +2 -0
- package/dist/bundle/chunks/chunk-A4JSPFCI.js +6 -0
- package/dist/bundle/chunks/chunk-A7A2DBEE.js +6 -0
- package/dist/bundle/chunks/chunk-A7ICOL4V.js +13 -0
- package/dist/bundle/chunks/chunk-ALLTKNUZ.js +5 -0
- package/dist/bundle/chunks/chunk-APT7OOP2.js +1 -0
- package/dist/bundle/chunks/{file-APPTAFMI.js → chunk-CR5AFCPT.js} +1 -1
- package/dist/bundle/chunks/{time-EGF4KTWV.js → chunk-CSBFBYLD.js} +5 -5
- package/dist/bundle/chunks/chunk-D4J545R4.js +11 -0
- package/dist/bundle/chunks/chunk-DCAAORBQ.js +1 -0
- package/dist/bundle/chunks/chunk-DZ33S2U7.js +31 -0
- package/dist/bundle/chunks/{nl-KWQGFZH5.js → chunk-F23WWYKW.js} +7 -7
- package/dist/bundle/chunks/chunk-FRDGR5VK.js +5 -0
- package/dist/bundle/chunks/chunk-GCTKCWKD.js +3 -0
- package/dist/bundle/chunks/chunk-GXVXFKBA.js +5 -0
- package/dist/bundle/chunks/chunk-GZ2N3SXD.js +8 -0
- package/dist/bundle/chunks/{sqlite3-DK5YHTWU.js → chunk-HDZ4QEVJ.js} +9 -9
- package/dist/bundle/chunks/chunk-HJQJAYMS.js +2 -0
- package/dist/bundle/chunks/chunk-HXILPMCG.js +5 -0
- package/dist/bundle/chunks/chunk-IBFD7QQD.js +5 -0
- package/dist/bundle/chunks/chunk-IKZ5LEGB.js +6 -0
- package/dist/bundle/chunks/{xan-EN6JZQ3T.js → chunk-JI3KJ32H.js} +17 -17
- package/dist/bundle/chunks/chunk-JVPRLUMK.js +7 -0
- package/dist/bundle/chunks/chunk-K3PAWJ7V.js +7 -0
- package/dist/bundle/chunks/chunk-KAEMRWOH.js +15 -0
- package/dist/bundle/chunks/chunk-KTGH7NTP.js +15 -0
- package/dist/bundle/chunks/chunk-KY5VPZXG.js +23 -0
- package/dist/bundle/chunks/{printf-4U5V2VHK.js → chunk-L4KW73FJ.js} +11 -11
- package/dist/bundle/chunks/chunk-LL3S3NLB.js +1 -0
- package/dist/bundle/chunks/chunk-LWEGUNWT.js +7 -0
- package/dist/bundle/chunks/chunk-MDLLFABN.js +4 -0
- package/dist/bundle/chunks/chunk-NCNPKYJZ.js +2 -0
- package/dist/bundle/chunks/chunk-NQOQ2Q77.js +8 -0
- package/dist/bundle/chunks/chunk-NUYSJFDK.js +7 -0
- package/dist/bundle/chunks/chunk-OCK72LWW.js +4 -0
- package/dist/bundle/chunks/chunk-OCLXQMOG.js +6 -0
- package/dist/bundle/chunks/{rmdir-DU6C7ZEO.js → chunk-OCS6LSEM.js} +3 -3
- package/dist/bundle/chunks/chunk-OFJTSXN6.js +8 -0
- package/dist/bundle/chunks/chunk-OGDTSM2Q.js +8 -0
- package/dist/bundle/chunks/chunk-PP6PSHAB.js +4 -0
- package/dist/bundle/chunks/chunk-PYSFUGCK.js +10 -0
- package/dist/bundle/chunks/chunk-QCDB2VPH.js +6 -0
- package/dist/bundle/chunks/{rg-JNKRPEYR.js → chunk-QOENL5UZ.js} +9 -9
- package/dist/bundle/chunks/chunk-R6QSAL5T.js +1 -0
- package/dist/bundle/chunks/chunk-S6BBC45K.js +8 -0
- package/dist/bundle/chunks/chunk-SL4FN3A5.js +9 -0
- package/dist/bundle/chunks/chunk-SXR3EI72.js +4 -0
- package/dist/bundle/chunks/chunk-TLSUDHID.js +6 -0
- package/dist/bundle/chunks/chunk-U7QI5ZS5.js +4 -0
- package/dist/bundle/chunks/{chunk-RERCNF7Z.js → chunk-UJXASUXJ.js} +41 -41
- package/dist/bundle/chunks/chunk-UYGR3CFC.js +2 -0
- package/dist/bundle/chunks/chunk-VJFXDYWH.js +10 -0
- package/dist/bundle/chunks/chunk-VOBGTVA6.js +6 -0
- package/dist/bundle/chunks/chunk-VYOJP4TV.js +13 -0
- package/dist/bundle/chunks/{tar-5V4PGBFL.js → chunk-VZWXH2PZ.js} +6 -6
- package/dist/bundle/chunks/{sed-4K5HXNXE.js → chunk-WACZHM4L.js} +36 -36
- package/dist/bundle/chunks/chunk-WMLBQOWO.js +9 -0
- package/dist/bundle/chunks/{tr-UJSEBPIQ.js → chunk-X6JMGGW2.js} +5 -5
- package/dist/bundle/chunks/chunk-XKQRETAK.js +1 -0
- package/dist/bundle/chunks/{yq-JD6M7T5A.js → chunk-XMDVFEVC.js} +24 -24
- package/dist/bundle/chunks/chunk-XNL7YAHW.js +11 -0
- package/dist/bundle/chunks/chunk-XVDPCNWR.js +11 -0
- package/dist/bundle/chunks/chunk-XZ3MZS57.js +6 -0
- package/dist/bundle/chunks/chunk-YYB54I7F.js +10 -0
- package/dist/bundle/chunks/chunk-Z7JVV2SM.js +12 -0
- package/dist/bundle/chunks/chunk-ZKLK6C7H.js +15 -0
- package/dist/bundle/chunks/clear-5CZ5X4YR.js +1 -0
- package/dist/bundle/chunks/column-WLPMMSTS.js +1 -0
- package/dist/bundle/chunks/comm-5SLSESQG.js +1 -0
- package/dist/bundle/chunks/cp-XOYR4ABJ.js +1 -0
- package/dist/bundle/chunks/cut-LO6YYY5P.js +1 -0
- package/dist/bundle/chunks/date-FT2P5UCQ.js +1 -0
- package/dist/bundle/chunks/diff-HJF2MPDN.js +1 -0
- package/dist/bundle/chunks/dirname-LEMTZZFS.js +1 -0
- package/dist/bundle/chunks/du-DM4QX4XA.js +1 -0
- package/dist/bundle/chunks/echo-O45JWWI2.js +1 -0
- package/dist/bundle/chunks/env-S547XMN7.js +1 -0
- package/dist/bundle/chunks/expand-DTNXU4LQ.js +1 -0
- package/dist/bundle/chunks/{expansion-OFFC2R4K.js → expansion-L4NRX44B.js} +1 -1
- package/dist/bundle/chunks/expr-3572LAOT.js +1 -0
- package/dist/bundle/chunks/file-ZIGAJ4YS.js +1 -0
- package/dist/bundle/chunks/find-74OP3M7S.js +1 -0
- package/dist/bundle/chunks/flag-coverage-5KOYWCUN.js +1 -0
- package/dist/bundle/chunks/fold-LDSORVYE.js +1 -0
- package/dist/bundle/chunks/grep-BPEMMINR.js +1 -0
- package/dist/bundle/chunks/gzip-UTSGNF5Z.js +1 -0
- package/dist/bundle/chunks/head-HT2B6D2J.js +1 -0
- package/dist/bundle/chunks/help-T2NGLTSG.js +1 -0
- package/dist/bundle/chunks/history-J4QRNGRO.js +1 -0
- package/dist/bundle/chunks/hostname-BK6HG2DE.js +1 -0
- package/dist/bundle/chunks/html-to-markdown-TFCECAGV.js +1 -0
- package/dist/bundle/chunks/join-GG2LDHE5.js +1 -0
- package/dist/bundle/chunks/jq-OJYNICKX.js +1 -0
- package/dist/bundle/chunks/ln-YAIFIHCT.js +1 -0
- package/dist/bundle/chunks/ls-OTONBH2E.js +1 -0
- package/dist/bundle/chunks/md5sum-INMIK4DX.js +1 -0
- package/dist/bundle/chunks/mkdir-QWGXDWUS.js +1 -0
- package/dist/bundle/chunks/mv-Z6MORUFL.js +1 -0
- package/dist/bundle/chunks/nl-U5YJDM32.js +1 -0
- package/dist/bundle/chunks/od-VJEF2UR5.js +1 -0
- package/dist/bundle/chunks/paste-7N6AFSDS.js +1 -0
- package/dist/bundle/chunks/printf-KGN6BDCY.js +1 -0
- package/dist/bundle/chunks/pwd-D4OZ7N27.js +1 -0
- package/dist/bundle/chunks/readlink-IEQO24KU.js +1 -0
- package/dist/bundle/chunks/rev-XOSYPP45.js +1 -0
- package/dist/bundle/chunks/rg-ORQK4GVH.js +1 -0
- package/dist/bundle/chunks/rm-KPTLPKPH.js +1 -0
- package/dist/bundle/chunks/rmdir-XTQXT7RK.js +1 -0
- package/dist/bundle/chunks/sed-RXIECPPB.js +1 -0
- package/dist/bundle/chunks/seq-RN5ZUASB.js +1 -0
- package/dist/bundle/chunks/sha1sum-VJPNLNU6.js +1 -0
- package/dist/bundle/chunks/sha256sum-PI32XWXY.js +1 -0
- package/dist/bundle/chunks/sleep-JHK4I472.js +1 -0
- package/dist/bundle/chunks/sort-T7TNLWXL.js +1 -0
- package/dist/bundle/chunks/split-EZOC5IIZ.js +1 -0
- package/dist/bundle/chunks/sqlite3-Z2IGWYCE.js +1 -0
- package/dist/bundle/chunks/stat-74KBZFAX.js +1 -0
- package/dist/bundle/chunks/strings-7PLOGTPD.js +1 -0
- package/dist/bundle/chunks/tac-T7YAU2Y6.js +1 -0
- package/dist/bundle/chunks/tail-S5ULNTJU.js +1 -0
- package/dist/bundle/chunks/tar-K7K7BL55.js +1 -0
- package/dist/bundle/chunks/tee-O7VXZDCO.js +1 -0
- package/dist/bundle/chunks/time-BPT76IHZ.js +1 -0
- package/dist/bundle/chunks/timeout-5UJUQXOE.js +1 -0
- package/dist/bundle/chunks/touch-DX2IJOQ4.js +1 -0
- package/dist/bundle/chunks/tr-RYO2EDCA.js +1 -0
- package/dist/bundle/chunks/tree-LYXBS7DC.js +1 -0
- package/dist/bundle/chunks/true-WHJNXCHG.js +1 -0
- package/dist/bundle/chunks/unexpand-RGTMIGZM.js +1 -0
- package/dist/bundle/chunks/uniq-ZXE4O5XB.js +1 -0
- package/dist/bundle/chunks/wc-TQB3VNOX.js +1 -0
- package/dist/bundle/chunks/which-NCIYTMAT.js +1 -0
- package/dist/bundle/chunks/whoami-DGKU3D2X.js +1 -0
- package/dist/bundle/chunks/xan-Z6KVJKEE.js +1 -0
- package/dist/bundle/chunks/xargs-OGI2NN6J.js +1 -0
- package/dist/bundle/chunks/yq-FD5F3WOJ.js +1 -0
- package/dist/bundle/index.js +157 -155
- package/dist/commands/alias/alias.d.ts +3 -0
- package/dist/commands/awk/awk2.d.ts +2 -0
- package/dist/commands/awk/interpreter/context.d.ts +5 -0
- package/dist/commands/base64/base64.d.ts +2 -0
- package/dist/commands/basename/basename.d.ts +2 -0
- package/dist/commands/bash/bash.d.ts +3 -0
- package/dist/commands/cat/cat.d.ts +2 -0
- package/dist/commands/chmod/chmod.d.ts +2 -0
- package/dist/commands/clear/clear.d.ts +2 -0
- package/dist/commands/column/column.d.ts +2 -0
- package/dist/commands/comm/comm.d.ts +2 -0
- package/dist/commands/cp/cp.d.ts +2 -0
- package/dist/commands/cut/cut.d.ts +2 -0
- package/dist/commands/date/date.d.ts +2 -0
- package/dist/commands/diff/diff.d.ts +2 -0
- package/dist/commands/dirname/dirname.d.ts +2 -0
- package/dist/commands/du/du.d.ts +2 -0
- package/dist/commands/echo/echo.d.ts +2 -0
- package/dist/commands/env/env.d.ts +3 -0
- package/dist/commands/expand/expand.d.ts +2 -0
- package/dist/commands/expand/unexpand.d.ts +2 -0
- package/dist/commands/expr/expr.d.ts +2 -0
- package/dist/commands/file/file.d.ts +2 -0
- package/dist/commands/find/find.d.ts +2 -0
- package/dist/commands/flag-coverage.d.ts +2 -0
- package/dist/commands/fold/fold.d.ts +2 -0
- package/dist/commands/fuzz-flags-types.d.ts +17 -0
- package/dist/commands/fuzz-flags.d.ts +8 -0
- package/dist/commands/grep/grep.d.ts +4 -0
- package/dist/commands/gzip/gzip.d.ts +4 -0
- package/dist/commands/head/head.d.ts +2 -0
- package/dist/commands/help/help.d.ts +2 -0
- package/dist/commands/history/history.d.ts +2 -0
- package/dist/commands/hostname/hostname.d.ts +2 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +2 -0
- package/dist/commands/join/join.d.ts +2 -0
- package/dist/commands/jq/jq.d.ts +2 -0
- package/dist/commands/ln/ln.d.ts +2 -0
- package/dist/commands/ls/ls.d.ts +2 -0
- package/dist/commands/md5sum/md5sum.d.ts +2 -0
- package/dist/commands/md5sum/sha1sum.d.ts +2 -0
- package/dist/commands/md5sum/sha256sum.d.ts +2 -0
- package/dist/commands/mkdir/mkdir.d.ts +2 -0
- package/dist/commands/mv/mv.d.ts +2 -0
- package/dist/commands/nl/nl.d.ts +2 -0
- package/dist/commands/od/od.d.ts +2 -0
- package/dist/commands/paste/paste.d.ts +2 -0
- package/dist/commands/printf/printf.d.ts +2 -0
- package/dist/commands/pwd/pwd.d.ts +2 -0
- package/dist/commands/query-engine/evaluator.d.ts +4 -0
- package/dist/commands/readlink/readlink.d.ts +2 -0
- package/dist/commands/rev/rev.d.ts +2 -0
- package/dist/commands/rg/rg.d.ts +2 -0
- package/dist/commands/rm/rm.d.ts +2 -0
- package/dist/commands/rmdir/rmdir.d.ts +2 -0
- package/dist/commands/sed/sed.d.ts +2 -0
- package/dist/commands/sed/types.d.ts +2 -0
- package/dist/commands/seq/seq.d.ts +2 -0
- package/dist/commands/sleep/sleep.d.ts +2 -0
- package/dist/commands/sort/sort.d.ts +2 -0
- package/dist/commands/split/split.d.ts +2 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +2 -0
- package/dist/commands/stat/stat.d.ts +2 -0
- package/dist/commands/strings/strings.d.ts +2 -0
- package/dist/commands/tac/tac.d.ts +2 -0
- package/dist/commands/tail/tail.d.ts +2 -0
- package/dist/commands/tar/tar.d.ts +2 -0
- package/dist/commands/tee/tee.d.ts +2 -0
- package/dist/commands/time/time.d.ts +2 -0
- package/dist/commands/timeout/timeout.d.ts +2 -0
- package/dist/commands/touch/touch.d.ts +2 -0
- package/dist/commands/tr/tr.d.ts +2 -0
- package/dist/commands/tree/tree.d.ts +2 -0
- package/dist/commands/true/true.d.ts +3 -0
- package/dist/commands/uniq/uniq.d.ts +2 -0
- package/dist/commands/wc/wc.d.ts +2 -0
- package/dist/commands/which/which.d.ts +2 -0
- package/dist/commands/whoami/whoami.d.ts +2 -0
- package/dist/commands/xan/xan.d.ts +2 -0
- package/dist/commands/xargs/xargs.d.ts +2 -0
- package/dist/commands/yq/yq.d.ts +2 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +7 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +7 -0
- package/dist/interpreter/interpreter.d.ts +3 -1
- package/dist/interpreter/types.d.ts +3 -1
- package/dist/network/types.d.ts +11 -0
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
- package/dist/bin/chunks/alias-MGDOL4KG.js +0 -7
- package/dist/bin/chunks/awk2-OKD2P6CM.js +0 -21
- package/dist/bin/chunks/base64-43KPK6TL.js +0 -6
- package/dist/bin/chunks/basename-SO5MVUEX.js +0 -6
- package/dist/bin/chunks/bash-OAUBNRSG.js +0 -6
- package/dist/bin/chunks/cat-HNXE2ES2.js +0 -6
- package/dist/bin/chunks/chmod-TYLTHXFR.js +0 -9
- package/dist/bin/chunks/chunk-HSNUCOOQ.js +0 -6
- package/dist/bin/chunks/clear-CI7A5IXQ.js +0 -2
- package/dist/bin/chunks/column-HQ4AK5DM.js +0 -8
- package/dist/bin/chunks/comm-CPIFQTKY.js +0 -13
- package/dist/bin/chunks/cp-VFXCUKXO.js +0 -8
- package/dist/bin/chunks/cut-IHF6BEOO.js +0 -6
- package/dist/bin/chunks/date-IQLPMFYI.js +0 -5
- package/dist/bin/chunks/diff-ZGXLP3DN.js +0 -19
- package/dist/bin/chunks/dirname-EES7TR26.js +0 -5
- package/dist/bin/chunks/du-PECPOFQT.js +0 -8
- package/dist/bin/chunks/echo-7I42V66Q.js +0 -4
- package/dist/bin/chunks/env-W6IMQ43Y.js +0 -9
- package/dist/bin/chunks/expand-77K5HH2M.js +0 -11
- package/dist/bin/chunks/expr-433HIVAI.js +0 -5
- package/dist/bin/chunks/find-KHOYETRP.js +0 -11
- package/dist/bin/chunks/fold-452R4I2C.js +0 -12
- package/dist/bin/chunks/grep-BD56656Z.js +0 -9
- package/dist/bin/chunks/gzip-5ILPB46W.js +0 -32
- package/dist/bin/chunks/head-TJHLLIMR.js +0 -2
- package/dist/bin/chunks/help-L43ENI4H.js +0 -16
- package/dist/bin/chunks/history-56DL6SXU.js +0 -3
- package/dist/bin/chunks/hostname-WXDKRL2Z.js +0 -3
- package/dist/bin/chunks/join-3IXMEGNA.js +0 -14
- package/dist/bin/chunks/jq-EIPK4SZA.js +0 -13
- package/dist/bin/chunks/ln-EFFNQ3RY.js +0 -10
- package/dist/bin/chunks/ls-5LN47VHU.js +0 -26
- package/dist/bin/chunks/md5sum-VHPDBIVV.js +0 -2
- package/dist/bin/chunks/mkdir-XMSNS6S5.js +0 -7
- package/dist/bin/chunks/mv-P4KHB27X.js +0 -7
- package/dist/bin/chunks/od-KRKGC2U3.js +0 -5
- package/dist/bin/chunks/paste-UCH462KK.js +0 -8
- package/dist/bin/chunks/printf-4W7NDLLV.js +0 -15
- package/dist/bin/chunks/pwd-L26WH2K4.js +0 -3
- package/dist/bin/chunks/readlink-VL3R4LAM.js +0 -7
- package/dist/bin/chunks/rev-VP42N2JN.js +0 -7
- package/dist/bin/chunks/rm-S7ASVG34.js +0 -8
- package/dist/bin/chunks/seq-AVK43XM2.js +0 -7
- package/dist/bin/chunks/sha1sum-4SVNPPXZ.js +0 -2
- package/dist/bin/chunks/sha256sum-BM3AFTIE.js +0 -2
- package/dist/bin/chunks/sort-QF3YLXRW.js +0 -16
- package/dist/bin/chunks/split-7UP7EATZ.js +0 -16
- package/dist/bin/chunks/stat-ZZVPXHLF.js +0 -9
- package/dist/bin/chunks/strings-ZEKN6D4Q.js +0 -14
- package/dist/bin/chunks/tac-KNRFDAY7.js +0 -9
- package/dist/bin/chunks/tail-YAUIERGN.js +0 -2
- package/dist/bin/chunks/tee-XSKPK43X.js +0 -3
- package/dist/bin/chunks/timeout-JED4EKFH.js +0 -12
- package/dist/bin/chunks/touch-IBPHJBM3.js +0 -7
- package/dist/bin/chunks/tree-WC3AXFHC.js +0 -12
- package/dist/bin/chunks/true-OVATH2SQ.js +0 -2
- package/dist/bin/chunks/unexpand-BFVYAPOU.js +0 -11
- package/dist/bin/chunks/uniq-NNXAFO6D.js +0 -5
- package/dist/bin/chunks/wc-CZ2TD6T6.js +0 -6
- package/dist/bin/chunks/which-5QEJAXNR.js +0 -3
- package/dist/bin/chunks/whoami-JVLUNKSG.js +0 -3
- package/dist/bin/chunks/xargs-IWT2HHEA.js +0 -5
- package/dist/bin/shell/chunks/alias-MGDOL4KG.js +0 -7
- package/dist/bin/shell/chunks/awk2-OKD2P6CM.js +0 -21
- package/dist/bin/shell/chunks/base64-43KPK6TL.js +0 -6
- package/dist/bin/shell/chunks/basename-SO5MVUEX.js +0 -6
- package/dist/bin/shell/chunks/bash-OAUBNRSG.js +0 -6
- package/dist/bin/shell/chunks/cat-HNXE2ES2.js +0 -6
- package/dist/bin/shell/chunks/chmod-TYLTHXFR.js +0 -9
- package/dist/bin/shell/chunks/chunk-HSNUCOOQ.js +0 -6
- package/dist/bin/shell/chunks/clear-CI7A5IXQ.js +0 -2
- package/dist/bin/shell/chunks/column-HQ4AK5DM.js +0 -8
- package/dist/bin/shell/chunks/comm-CPIFQTKY.js +0 -13
- package/dist/bin/shell/chunks/cp-VFXCUKXO.js +0 -8
- package/dist/bin/shell/chunks/cut-IHF6BEOO.js +0 -6
- package/dist/bin/shell/chunks/date-IQLPMFYI.js +0 -5
- package/dist/bin/shell/chunks/diff-ZGXLP3DN.js +0 -19
- package/dist/bin/shell/chunks/dirname-EES7TR26.js +0 -5
- package/dist/bin/shell/chunks/du-PECPOFQT.js +0 -8
- package/dist/bin/shell/chunks/echo-7I42V66Q.js +0 -4
- package/dist/bin/shell/chunks/env-W6IMQ43Y.js +0 -9
- package/dist/bin/shell/chunks/expand-77K5HH2M.js +0 -11
- package/dist/bin/shell/chunks/expr-433HIVAI.js +0 -5
- package/dist/bin/shell/chunks/find-KHOYETRP.js +0 -11
- package/dist/bin/shell/chunks/fold-452R4I2C.js +0 -12
- package/dist/bin/shell/chunks/grep-BD56656Z.js +0 -9
- package/dist/bin/shell/chunks/gzip-5ILPB46W.js +0 -32
- package/dist/bin/shell/chunks/head-TJHLLIMR.js +0 -2
- package/dist/bin/shell/chunks/help-L43ENI4H.js +0 -16
- package/dist/bin/shell/chunks/history-56DL6SXU.js +0 -3
- package/dist/bin/shell/chunks/hostname-WXDKRL2Z.js +0 -3
- package/dist/bin/shell/chunks/join-3IXMEGNA.js +0 -14
- package/dist/bin/shell/chunks/jq-EIPK4SZA.js +0 -13
- package/dist/bin/shell/chunks/ln-EFFNQ3RY.js +0 -10
- package/dist/bin/shell/chunks/ls-5LN47VHU.js +0 -26
- package/dist/bin/shell/chunks/md5sum-VHPDBIVV.js +0 -2
- package/dist/bin/shell/chunks/mkdir-XMSNS6S5.js +0 -7
- package/dist/bin/shell/chunks/mv-P4KHB27X.js +0 -7
- package/dist/bin/shell/chunks/od-KRKGC2U3.js +0 -5
- package/dist/bin/shell/chunks/paste-UCH462KK.js +0 -8
- package/dist/bin/shell/chunks/printf-4W7NDLLV.js +0 -15
- package/dist/bin/shell/chunks/pwd-L26WH2K4.js +0 -3
- package/dist/bin/shell/chunks/readlink-VL3R4LAM.js +0 -7
- package/dist/bin/shell/chunks/rev-VP42N2JN.js +0 -7
- package/dist/bin/shell/chunks/rm-S7ASVG34.js +0 -8
- package/dist/bin/shell/chunks/seq-AVK43XM2.js +0 -7
- package/dist/bin/shell/chunks/sha1sum-4SVNPPXZ.js +0 -2
- package/dist/bin/shell/chunks/sha256sum-BM3AFTIE.js +0 -2
- package/dist/bin/shell/chunks/sort-QF3YLXRW.js +0 -16
- package/dist/bin/shell/chunks/split-7UP7EATZ.js +0 -16
- package/dist/bin/shell/chunks/stat-ZZVPXHLF.js +0 -9
- package/dist/bin/shell/chunks/strings-ZEKN6D4Q.js +0 -14
- package/dist/bin/shell/chunks/tac-KNRFDAY7.js +0 -9
- package/dist/bin/shell/chunks/tail-YAUIERGN.js +0 -2
- package/dist/bin/shell/chunks/tee-XSKPK43X.js +0 -3
- package/dist/bin/shell/chunks/timeout-JED4EKFH.js +0 -12
- package/dist/bin/shell/chunks/touch-IBPHJBM3.js +0 -7
- package/dist/bin/shell/chunks/tree-WC3AXFHC.js +0 -12
- package/dist/bin/shell/chunks/true-OVATH2SQ.js +0 -2
- package/dist/bin/shell/chunks/unexpand-BFVYAPOU.js +0 -11
- package/dist/bin/shell/chunks/uniq-NNXAFO6D.js +0 -5
- package/dist/bin/shell/chunks/wc-CZ2TD6T6.js +0 -6
- package/dist/bin/shell/chunks/which-5QEJAXNR.js +0 -3
- package/dist/bin/shell/chunks/whoami-JVLUNKSG.js +0 -3
- package/dist/bin/shell/chunks/xargs-IWT2HHEA.js +0 -5
- package/dist/bundle/chunks/alias-YGOORMWI.js +0 -6
- package/dist/bundle/chunks/awk2-YNEKUV4T.js +0 -20
- package/dist/bundle/chunks/base64-2JFR3HGT.js +0 -5
- package/dist/bundle/chunks/basename-CFA5ZIGT.js +0 -5
- package/dist/bundle/chunks/bash-BYWM5OPC.js +0 -5
- package/dist/bundle/chunks/cat-GPKR7D6K.js +0 -5
- package/dist/bundle/chunks/chmod-ODWUR7E6.js +0 -8
- package/dist/bundle/chunks/chunk-WQCJYUEW.js +0 -5
- package/dist/bundle/chunks/clear-VT2LJIDX.js +0 -1
- package/dist/bundle/chunks/column-R6OLMEUA.js +0 -7
- package/dist/bundle/chunks/comm-AXQM7FFF.js +0 -12
- package/dist/bundle/chunks/cp-NJSENVKC.js +0 -7
- package/dist/bundle/chunks/cut-NVKWEAZF.js +0 -5
- package/dist/bundle/chunks/date-PN3CMG7K.js +0 -4
- package/dist/bundle/chunks/diff-ELUS3RW7.js +0 -6
- package/dist/bundle/chunks/dirname-YPJLCQYA.js +0 -4
- package/dist/bundle/chunks/du-T4JUAAB2.js +0 -7
- package/dist/bundle/chunks/echo-6S7WE7XB.js +0 -3
- package/dist/bundle/chunks/env-M3AXY56V.js +0 -8
- package/dist/bundle/chunks/expand-VSTNOVF5.js +0 -10
- package/dist/bundle/chunks/expr-YSFDPKPV.js +0 -4
- package/dist/bundle/chunks/find-WTVSUXL3.js +0 -10
- package/dist/bundle/chunks/fold-6CFXIPYZ.js +0 -11
- package/dist/bundle/chunks/grep-UTH3KDWL.js +0 -8
- package/dist/bundle/chunks/gzip-4P4KGYT5.js +0 -31
- package/dist/bundle/chunks/head-SA7P5NJ7.js +0 -1
- package/dist/bundle/chunks/help-UD3E73G5.js +0 -15
- package/dist/bundle/chunks/history-TMBGOQO6.js +0 -2
- package/dist/bundle/chunks/hostname-NWR32CGF.js +0 -2
- package/dist/bundle/chunks/html-to-markdown-ZK6GQVSL.js +0 -4
- package/dist/bundle/chunks/join-X3QYPZUA.js +0 -13
- package/dist/bundle/chunks/jq-6U2TPE6U.js +0 -12
- package/dist/bundle/chunks/ln-Y7YB677N.js +0 -9
- package/dist/bundle/chunks/ls-PUJHEPXS.js +0 -23
- package/dist/bundle/chunks/md5sum-TGZPGVOK.js +0 -1
- package/dist/bundle/chunks/mkdir-SF2UE4KB.js +0 -6
- package/dist/bundle/chunks/mv-JPBZPM4O.js +0 -6
- package/dist/bundle/chunks/od-3FPDPLWJ.js +0 -4
- package/dist/bundle/chunks/paste-QAP6Y75J.js +0 -7
- package/dist/bundle/chunks/pwd-S4NVAMC4.js +0 -2
- package/dist/bundle/chunks/readlink-EM4O3U4P.js +0 -6
- package/dist/bundle/chunks/rev-FKUV5GH5.js +0 -6
- package/dist/bundle/chunks/rm-MJFRIDNT.js +0 -7
- package/dist/bundle/chunks/seq-5VRIVQYP.js +0 -6
- package/dist/bundle/chunks/sha1sum-37LOTSQP.js +0 -1
- package/dist/bundle/chunks/sha256sum-I4J5BPZA.js +0 -1
- package/dist/bundle/chunks/sleep-AK4QE4WR.js +0 -9
- package/dist/bundle/chunks/sort-LT2PE47K.js +0 -15
- package/dist/bundle/chunks/split-LGSGJHV5.js +0 -15
- package/dist/bundle/chunks/stat-IOLJTP7U.js +0 -8
- package/dist/bundle/chunks/strings-LRU5XCFP.js +0 -13
- package/dist/bundle/chunks/tac-2X4JLF4W.js +0 -8
- package/dist/bundle/chunks/tail-52LRAWXT.js +0 -1
- package/dist/bundle/chunks/tee-4KHTWVWB.js +0 -2
- package/dist/bundle/chunks/timeout-X3X3N6IE.js +0 -11
- package/dist/bundle/chunks/touch-TDTEBHHI.js +0 -6
- package/dist/bundle/chunks/tree-UFVZH4SS.js +0 -11
- package/dist/bundle/chunks/true-CNJ54NE6.js +0 -1
- package/dist/bundle/chunks/unexpand-I7A2VXFD.js +0 -10
- package/dist/bundle/chunks/uniq-XBP4SJA3.js +0 -4
- package/dist/bundle/chunks/wc-VDPK3LVS.js +0 -5
- package/dist/bundle/chunks/which-GF77XMJD.js +0 -2
- package/dist/bundle/chunks/whoami-YUDAIS32.js +0 -2
- package/dist/bundle/chunks/xargs-4FRA6OJ7.js +0 -4
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as F,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-GZHFXDDO.js";import{a as et}from"./chunk-QSDVMMYI.js";import{a as $}from"./chunk-A4442AOC.js";import{d as G}from"./chunk-UYBH3FNE.js";import{a as H}from"./chunk-SE4C7FJY.js";import{a as We}from"./chunk-5WFYIUU2.js";import{a as D,b as K}from"./chunk-GTNBSMZR.js";import{b as Ue,d as Be,e as Ze,f as Qe}from"./chunk-KGOUQS5A.js";var q,_e=Ue(()=>{"use strict";q=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos<this.input.length;){let n=this.input[this.pos];if(n===" "||n===" "||n===`
|
|
3
3
|
`||n==="\r")this.pos++;else if(n==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
|
|
4
4
|
`;)this.pos++;else break}}nextToken(){let n=this.pos,t=this.input[this.pos];if(t>="0"&&t<="9")return this.readNumber();if(t==='"'||t==="'"||t==="`")return this.readString(t);if(t==="b"&&this.pos+1<this.input.length){let o=this.input[this.pos+1];if(o==='"'||o==="'"||o==="`")return this.pos++,this.readString(o)}if(t==="/"){let o=this.tokens[this.tokens.length-1];return o&&(o.type==="int"||o.type==="float"||o.type==="string"||o.type==="ident"||o.type===")"||o.type==="]")?this.input[this.pos+1]==="/"?(this.pos+=2,{type:"//",value:"//",pos:n}):(this.pos++,{type:"/",value:"/",pos:n}):this.readRegex()}if(this.match("not in"))return{type:"not in",value:"not in",pos:n};if(this.match("=>"))return{type:"=>",value:"=>",pos:n};if(this.match("**"))return{type:"**",value:"**",pos:n};if(this.match("++"))return{type:"++",value:"++",pos:n};if(this.match("//"))return{type:"//",value:"//",pos:n};if(this.match("=="))return{type:"==",value:"==",pos:n};if(this.match("!="))return{type:"!=",value:"!=",pos:n};if(this.match("<="))return{type:"<=",value:"<=",pos:n};if(this.match(">="))return{type:">=",value:">=",pos:n};if(this.match("&&"))return{type:"&&",value:"&&",pos:n};if(this.match("||"))return{type:"||",value:"||",pos:n};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(t);if(r!==void 0)return this.pos++,{type:r,value:t,pos:n};if(this.isIdentStart(t))return this.readIdentifier();throw new Error(`Unexpected character '${t}' at position ${this.pos}`)}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){if(/^[a-zA-Z]/.test(n)){let t=this.input[this.pos+n.length];if(t&&this.isIdentChar(t))return!1}return this.pos+=n.length,!0}return!1}isIdentStart(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"}isIdentChar(n){return this.isIdentStart(n)||n>="0"&&n<="9"}readNumber(){let n=this.pos,t=!1,s=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o>="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!t&&!s)t=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,t=!0,this.pos++,this.pos<this.input.length&&(this.input[this.pos]==="+"||this.input[this.pos]==="-")&&this.pos++;else break}let r=this.input.slice(n,this.pos).replace(/_/g,"");return{type:t?"float":"int",value:r,pos:n}}readString(n){let t=this.pos;this.pos++;let s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===n)return this.pos++,{type:"string",value:s,pos:t};if(r==="\\"){if(this.pos++,this.pos<this.input.length){let o=this.input[this.pos];switch(o){case"n":s+=`
|
|
5
|
-
`;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${t}`)}readRegex(){let n=this.pos;this.pos++;let t="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:t+(s?`/${s}`:""),pos:n}}r==="\\"?(t+=r,this.pos++,this.pos<this.input.length&&(t+=this.input[this.pos],this.pos++)):(t+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${n}`)}readIdentifier(){let n=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let t=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(t=!0,this.pos++);let s=this.input.slice(n,t?this.pos-1:this.pos);t&&(s+="?");let r=new Map([["true","true"],["false","false"],["null","null"],["and","and"],["or","or"],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["in","in"],["as","as"],["_","_"]]),o=s.replace(/\?$/,""),i=r.get(o);return i!==void 0&&!t?{type:i,value:o,pos:n}:{type:"ident",value:s,pos:n}}}});var He={};Be(He,{parseMoonblade:()=>_,parseNamedExpressions:()=>V});function V(e){let n=[],s=new q(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},i=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){i();continue}let h=[],u=0,p=r;for(;o().type!=="eof";){let a=o();if((a.type===","||a.type==="as")&&u===0)break;(a.type==="("||a.type==="["||a.type==="{")&&u++,(a.type===")"||a.type==="]"||a.type==="}")&&u--,h.push(i())}h.push({type:"eof",value:"",pos:0});let f=new J(h).parse(),c;if(o().type==="as")if(i(),o().type==="("){i();let a=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(a.push(o().value),i()),o().type===","&&i();o().type===")"&&i(),c=a}else if(o().type==="ident"||o().type==="string")c=o().value,i();else throw new Error(`Expected name after 'as', got ${o().type}`);else c=e.slice(s[p].pos,s[r-1]?.pos||e.length).trim(),f.type==="identifier"&&(c=f.name);n.push({expr:f,name:c})}return n}function _(e){let t=new q(e).tokenize();return new J(t).parse()}var R,J,U=Ue(()=>{"use strict";_e();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},J=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<n)break;t=this.parseInfix(t,r)}return t}parsePrefix(){let n=this.peek();switch(n.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(n.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(n.value)};case"string":return this.advance(),{type:"string",value:n.value};case"regex":{this.advance();let t=n.value.split("/"),s=t.length>1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let t=[];if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=this.peek().value;if(this.advance(),this.peek().type===","||this.peek().type===")"){for(t.push(r);this.peek().type===","&&(this.advance(),this.peek().type==="ident");)t.push(this.peek().value),this.advance();if(this.peek().type===")"&&(this.advance(),this.peek().type==="=>")){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:t,body:o},t)}this.pos-=t.length*2,t.length>1&&(this.pos=this.pos)}this.pos--}let s=this.parseExpr(0);return this.expect(")"),this.peek().type,s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(R.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(R.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,i=this.pos+1;i<this.tokens.length&&this.tokens[i].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);t.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:n.toLowerCase(),args:t}}parseList(){this.expect("[");let n=[];if(this.peek().type!=="]")do n.length>0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let i=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:n},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(t);return this.handlePipe(n,i)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return R.PIPE;case"||":case"or":return R.OR;case"&&":case"and":return R.AND;case"==":case"!=":case"eq":case"ne":return R.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return R.COMPARISON;case"+":case"-":case"++":return R.ADDITIVE;case"*":case"/":case"//":case"%":return R.MULTIPLICATIVE;case"**":return R.POWER;case".":case"[":return R.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});U();function E(e,n){return n.length===0?k(e,[]):n.length===1?{type:"Pipe",left:n[0],right:k(e,[])}:{type:"Pipe",left:n[0],right:k(e,n.slice(1))}}var B={add:e=>S("+",e[0],e[1]),sub:e=>S("-",e[0],e[1]),mul:e=>S("*",e[0],e[1]),div:e=>S("/",e[0],e[1]),mod:e=>S("%",e[0],e[1]),idiv:e=>k("floor",[S("/",e[0],e[1])]),pow:e=>E("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>S("==",e[0],e[1]),"!=":e=>S("!=",e[0],e[1]),"<":e=>S("<",e[0],e[1]),"<=":e=>S("<=",e[0],e[1]),">":e=>S(">",e[0],e[1]),">=":e=>S(">=",e[0],e[1]),eq:e=>S("==",P(e[0]),P(e[1])),ne:e=>S("!=",P(e[0]),P(e[1])),lt:e=>S("<",P(e[0]),P(e[1])),le:e=>S("<=",P(e[0]),P(e[1])),gt:e=>S(">",P(e[0]),P(e[1])),ge:e=>S(">=",P(e[0]),P(e[1])),and:e=>S("and",e[0],e[1]),or:e=>S("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>E("length",e),length:e=>E("length",e),upper:e=>E("ascii_upcase",e),lower:e=>E("ascii_downcase",e),trim:e=>E("trim",e),ltrim:e=>e.length===0?k("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?k("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("rtrimstr",[{type:"Literal",value:" "}])},split:e=>E("split",e),join:e=>e.length===1?k("join",[{type:"Literal",value:""}]):E("join",e),concat:e=>S("+",e[0],e[1]),startswith:e=>E("startswith",e),endswith:e=>E("endswith",e),contains:e=>E("contains",e),replace:e=>E("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:S("+",e[1],e[2])},abs:e=>E("fabs",e),floor:e=>E("floor",e),ceil:e=>E("ceil",e),round:e=>E("round",e),sqrt:e=>E("sqrt",e),log:e=>E("log",e),log10:e=>E("log10",e),log2:e=>E("log2",e),exp:e=>E("exp",e),sin:e=>E("sin",e),cos:e=>E("cos",e),tan:e=>E("tan",e),asin:e=>E("asin",e),acos:e=>E("acos",e),atan:e=>E("atan",e),min:e=>E("min",e),max:e=>E("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>k("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>k("select",e),empty:()=>k("empty",[]),count:()=>k("length",[]),sum:e=>e.length===0?k("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:k("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},type:"type",isnull:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:null}):S("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:""}):S("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?k("tonumber",[]):k("tonumber",e),tostring:e=>e.length===0?k("tostring",[]):k("tostring",e),if:e=>Je(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let[n,...t]=e,s=S("and",S("!=",n,{type:"Literal",value:null}),S("!=",n,{type:"Literal",value:""}));return Je(s,n,t.length===1?t[0]:B.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>k("now",[]),fmt:e=>k("tostring",e),format:e=>k("tostring",e)};function S(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function k(e,n){return{type:"Call",name:e,args:n}}var tt="then";function Je(e,n,t){let s={type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}};return s[tt]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function F(e,n=!0){switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>F(r.expr,n)),s=Object.hasOwn(B,e.name)?B[e.name]:void 0;return typeof s=="function"?s(t):k(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=F(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:F(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?F(e.start,n):void 0,end:e.end?F(e.end,n):void 0};case"lambda":return F(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){let n=[],t=0;for(;t<e.length;){for(;t<e.length&&(e[t]===" "||e[t]===",");)t++;if(t>=e.length)break;let s=t;for(;t<e.length&&/\w/.test(e[t]);)t++;let r=e.slice(s,t);for(;t<e.length&&e[t]===" ";)t++;if(e[t]!=="(")break;t++;let o=1,i=t;for(;t<e.length&&o>0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let h=e.slice(i,t).trim();for(t++;t<e.length&&e[t]===" ";)t++;let u="";if(e.slice(t,t+3).toLowerCase()==="as "){for(t+=3;t<e.length&&e[t]===" ";)t++;let p=t;for(;t<e.length&&/\w/.test(e[t]);)t++;u=e.slice(p,t)}u||(u=h?`${r}(${h})`:`${r}()`),n.push({func:r,expr:h,alias:u})}return n}function ze(e){return/^\w+$/.test(e)}function Z(e,n,t){let s=F(_(n)),r=$(e,s,t);return r.length>0?r[0]:null}function ee(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(ze(r)?o=e.map(i=>i[r]).filter(i=>i!=null):o=e.map(i=>Z(i,r,t)).filter(i=>i!=null),s){case"count":return ze(r)?o.length:o.filter(i=>!!i).length;case"sum":return o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h))).reduce((h,u)=>h+u,0);case"mean":case"avg":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?i.reduce((h,u)=>h+u,0)/i.length:0}case"min":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.min(...i):null}case"max":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.max(...i):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let i=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(i.length===0)return null;let h=Math.floor(i.length/2);return i.length%2===0?(i[h-1]+i[h])/2:i[h]}case"mode":{let i=new Map;for(let p of o){let l=String(p);i.set(l,(i.get(l)||0)+1)}let h=0,u=null;for(let[p,l]of i)l>h&&(h=l,u=p);return u}case"cardinality":return new Set(o.map(h=>String(h))).size;case"values":return o.map(i=>String(i)).join("|");case"distinct_values":return[...new Set(o.map(h=>String(h)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let i of e)if(!Z(i,r,t))return!1;return!0}case"any":{for(let i of e)if(Z(i,r,t))return!0;return!1}default:return null}}function Ke(e,n,t={}){let s=O();for(let r of n)b(s,r.alias,ee(e,r,t));return s}async function te(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression
|
|
5
|
+
`;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${t}`)}readRegex(){let n=this.pos;this.pos++;let t="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:t+(s?`/${s}`:""),pos:n}}r==="\\"?(t+=r,this.pos++,this.pos<this.input.length&&(t+=this.input[this.pos],this.pos++)):(t+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${n}`)}readIdentifier(){let n=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let t=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(t=!0,this.pos++);let s=this.input.slice(n,t?this.pos-1:this.pos);t&&(s+="?");let r=new Map([["true","true"],["false","false"],["null","null"],["and","and"],["or","or"],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["in","in"],["as","as"],["_","_"]]),o=s.replace(/\?$/,""),i=r.get(o);return i!==void 0&&!t?{type:i,value:o,pos:n}:{type:"ident",value:s,pos:n}}}});var He={};Be(He,{parseMoonblade:()=>_,parseNamedExpressions:()=>V});function V(e){let n=[],s=new q(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},i=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){i();continue}let h=[],u=0,p=r;for(;o().type!=="eof";){let a=o();if((a.type===","||a.type==="as")&&u===0)break;(a.type==="("||a.type==="["||a.type==="{")&&u++,(a.type===")"||a.type==="]"||a.type==="}")&&u--,h.push(i())}h.push({type:"eof",value:"",pos:0});let f=new J(h).parse(),c;if(o().type==="as")if(i(),o().type==="("){i();let a=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(a.push(o().value),i()),o().type===","&&i();o().type===")"&&i(),c=a}else if(o().type==="ident"||o().type==="string")c=o().value,i();else throw new Error(`Expected name after 'as', got ${o().type}`);else c=e.slice(s[p].pos,s[r-1]?.pos||e.length).trim(),f.type==="identifier"&&(c=f.name);n.push({expr:f,name:c})}return n}function _(e){let t=new q(e).tokenize();return new J(t).parse()}var R,J,U=Ue(()=>{"use strict";_e();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},J=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<n)break;t=this.parseInfix(t,r)}return t}parsePrefix(){let n=this.peek();switch(n.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(n.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(n.value)};case"string":return this.advance(),{type:"string",value:n.value};case"regex":{this.advance();let t=n.value.split("/"),s=t.length>1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let t=[];if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=this.peek().value;if(this.advance(),this.peek().type===","||this.peek().type===")"){for(t.push(r);this.peek().type===","&&(this.advance(),this.peek().type==="ident");)t.push(this.peek().value),this.advance();if(this.peek().type===")"&&(this.advance(),this.peek().type==="=>")){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:t,body:o},t)}this.pos-=t.length*2,t.length>1&&(this.pos=this.pos)}this.pos--}let s=this.parseExpr(0);return this.expect(")"),this.peek().type,s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(R.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(R.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,i=this.pos+1;i<this.tokens.length&&this.tokens[i].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);t.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:n.toLowerCase(),args:t}}parseList(){this.expect("[");let n=[];if(this.peek().type!=="]")do n.length>0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let i=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:n},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(t);return this.handlePipe(n,i)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return R.PIPE;case"||":case"or":return R.OR;case"&&":case"and":return R.AND;case"==":case"!=":case"eq":case"ne":return R.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return R.COMPARISON;case"+":case"-":case"++":return R.ADDITIVE;case"*":case"/":case"//":case"%":return R.MULTIPLICATIVE;case"**":return R.POWER;case".":case"[":return R.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});U();function E(e,n){return n.length===0?k(e,[]):n.length===1?{type:"Pipe",left:n[0],right:k(e,[])}:{type:"Pipe",left:n[0],right:k(e,n.slice(1))}}var B={add:e=>S("+",e[0],e[1]),sub:e=>S("-",e[0],e[1]),mul:e=>S("*",e[0],e[1]),div:e=>S("/",e[0],e[1]),mod:e=>S("%",e[0],e[1]),idiv:e=>k("floor",[S("/",e[0],e[1])]),pow:e=>E("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>S("==",e[0],e[1]),"!=":e=>S("!=",e[0],e[1]),"<":e=>S("<",e[0],e[1]),"<=":e=>S("<=",e[0],e[1]),">":e=>S(">",e[0],e[1]),">=":e=>S(">=",e[0],e[1]),eq:e=>S("==",P(e[0]),P(e[1])),ne:e=>S("!=",P(e[0]),P(e[1])),lt:e=>S("<",P(e[0]),P(e[1])),le:e=>S("<=",P(e[0]),P(e[1])),gt:e=>S(">",P(e[0]),P(e[1])),ge:e=>S(">=",P(e[0]),P(e[1])),and:e=>S("and",e[0],e[1]),or:e=>S("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>E("length",e),length:e=>E("length",e),upper:e=>E("ascii_upcase",e),lower:e=>E("ascii_downcase",e),trim:e=>E("trim",e),ltrim:e=>e.length===0?k("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?k("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("rtrimstr",[{type:"Literal",value:" "}])},split:e=>E("split",e),join:e=>e.length===1?k("join",[{type:"Literal",value:""}]):E("join",e),concat:e=>S("+",e[0],e[1]),startswith:e=>E("startswith",e),endswith:e=>E("endswith",e),contains:e=>E("contains",e),replace:e=>E("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:S("+",e[1],e[2])},abs:e=>E("fabs",e),floor:e=>E("floor",e),ceil:e=>E("ceil",e),round:e=>E("round",e),sqrt:e=>E("sqrt",e),log:e=>E("log",e),log10:e=>E("log10",e),log2:e=>E("log2",e),exp:e=>E("exp",e),sin:e=>E("sin",e),cos:e=>E("cos",e),tan:e=>E("tan",e),asin:e=>E("asin",e),acos:e=>E("acos",e),atan:e=>E("atan",e),min:e=>E("min",e),max:e=>E("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>k("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>k("select",e),empty:()=>k("empty",[]),count:()=>k("length",[]),sum:e=>e.length===0?k("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:k("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},type:"type",isnull:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:null}):S("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:""}):S("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?k("tonumber",[]):k("tonumber",e),tostring:e=>e.length===0?k("tostring",[]):k("tostring",e),if:e=>Je(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let[n,...t]=e,s=S("and",S("!=",n,{type:"Literal",value:null}),S("!=",n,{type:"Literal",value:""}));return Je(s,n,t.length===1?t[0]:B.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>k("now",[]),fmt:e=>k("tostring",e),format:e=>k("tostring",e)};function S(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function k(e,n){return{type:"Call",name:e,args:n}}var tt="then";function Je(e,n,t){let s={type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}};return s[tt]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function O(e,n=!0){switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>O(r.expr,n)),s=Object.hasOwn(B,e.name)?B[e.name]:void 0;return typeof s=="function"?s(t):k(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=O(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:O(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?O(e.start,n):void 0,end:e.end?O(e.end,n):void 0};case"lambda":return O(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){let n=[],t=0;for(;t<e.length;){for(;t<e.length&&(e[t]===" "||e[t]===",");)t++;if(t>=e.length)break;let s=t;for(;t<e.length&&/\w/.test(e[t]);)t++;let r=e.slice(s,t);for(;t<e.length&&e[t]===" ";)t++;if(e[t]!=="(")break;t++;let o=1,i=t;for(;t<e.length&&o>0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let h=e.slice(i,t).trim();for(t++;t<e.length&&e[t]===" ";)t++;let u="";if(e.slice(t,t+3).toLowerCase()==="as "){for(t+=3;t<e.length&&e[t]===" ";)t++;let p=t;for(;t<e.length&&/\w/.test(e[t]);)t++;u=e.slice(p,t)}u||(u=h?`${r}(${h})`:`${r}()`),n.push({func:r,expr:h,alias:u})}return n}function ze(e){return/^\w+$/.test(e)}function Z(e,n,t){let s=O(_(n)),r=$(e,s,t);return r.length>0?r[0]:null}function ee(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(ze(r)?o=e.map(i=>i[r]).filter(i=>i!=null):o=e.map(i=>Z(i,r,t)).filter(i=>i!=null),s){case"count":return ze(r)?o.length:o.filter(i=>!!i).length;case"sum":return o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h))).reduce((h,u)=>h+u,0);case"mean":case"avg":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?i.reduce((h,u)=>h+u,0)/i.length:0}case"min":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.min(...i):null}case"max":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.max(...i):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let i=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(i.length===0)return null;let h=Math.floor(i.length/2);return i.length%2===0?(i[h-1]+i[h])/2:i[h]}case"mode":{let i=new Map;for(let p of o){let l=String(p);i.set(l,(i.get(l)||0)+1)}let h=0,u=null;for(let[p,l]of i)l>h&&(h=l,u=p);return u}case"cardinality":return new Set(o.map(h=>String(h))).size;case"values":return o.map(i=>String(i)).join("|");case"distinct_values":return[...new Set(o.map(h=>String(h)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let i of e)if(!Z(i,r,t))return!1;return!0}case"any":{for(let i of e)if(Z(i,r,t))return!0;return!1}default:return null}}function Ke(e,n,t={}){let s=F();for(let r of n)b(s,r.alias,ee(e,r,t));return s}async function te(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression
|
|
6
6
|
`,exitCode:1};let{data:r,error:o}=await v(s,n);if(o)return o;let i={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},h=Q(t),u=h.map(l=>l.alias),p=Ke(r,h,i);return{stdout:w(u,[p]),stderr:"",exitCode:0}}async function ne(e,n){let t="",s="",r=[];for(let d=0;d<e.length;d++){let m=e[d];m==="--sorted"||m.startsWith("-")||(t?s?r.push(m):s=m:t=m)}if(!t||!s)return{stdout:"",stderr:`xan groupby: usage: xan groupby COLS EXPR [FILE]
|
|
7
|
-
`,exitCode:1};let{data:o,error:i}=await v(r,n);if(i)return i;let h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},u=t.split(","),p=Q(s),l=[],f=new Map;for(let d of o){let m=u.map(g=>String(d[g])).join("\0");f.has(m)||(f.set(m,[]),l.push(m)),f.get(m)?.push(d)}let c=[...u,...p.map(d=>d.alias)],a=[];for(let d of l){let m=f.get(d);if(!m)continue;let g=
|
|
8
|
-
`,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=z(t,r),u=o.map(p=>{let l=
|
|
9
|
-
`,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set(z(t,r)),u=r.filter(l=>!h.has(l)),p=o.map(l=>{let f=
|
|
10
|
-
`,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;let u;if(s){let l=s.split(","),f=t.split(","),c=new Map;for(let a=0;a<l.length&&a<f.length;a++)c.set(l[a],f[a]);u=o.map(a=>c.get(a)||a)}else{let l=t.split(",");u=o.map((f,c)=>c<l.length?l[c]:f)}let p=i.map(l=>{let f=
|
|
7
|
+
`,exitCode:1};let{data:o,error:i}=await v(r,n);if(i)return i;let h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},u=t.split(","),p=Q(s),l=[],f=new Map;for(let d of o){let m=u.map(g=>String(d[g])).join("\0");f.has(m)||(f.set(m,[]),l.push(m)),f.get(m)?.push(d)}let c=[...u,...p.map(d=>d.alias)],a=[];for(let d of l){let m=f.get(d);if(!m)continue;let g=F();for(let y of u)b(g,y,m[0][y]);for(let y of p)b(g,y.alias,ee(m,y,h));a.push(g)}return{stdout:w(c,a),stderr:"",exitCode:0}}async function se(e,n){let t=[],s="",r=10,o=!1,i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--select")&&a+1<e.length?t=e[++a].split(","):(d==="-g"||d==="--groupby")&&a+1<e.length?s=e[++a]:(d==="-l"||d==="--limit")&&a+1<e.length?r=Number.parseInt(e[++a],10):d==="--no-extra"?o=!0:d==="-A"||d==="--all"?r=0:d.startsWith("-")||i.push(d)}let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;let l=t.length>0?t:h.filter(a=>a!==s);s&&t.length===0&&(l=h.filter(a=>a!==s));let f=[],c=s?["field",s,"value","count"]:["field","value","count"];if(s){let a=new Map;for(let d of u){let m=String(d[s]??"");a.has(m)||a.set(m,[]),a.get(m)?.push(d)}for(let d of l)for(let[m,g]of a){let y=new Map;for(let I of g){let N=I[d],C=N===""||N===null||N===void 0?"":String(N);y.set(C,(y.get(C)||0)+1)}let x=[...y.entries()].sort((I,N)=>N[1]!==I[1]?N[1]-I[1]:I[0].localeCompare(N[0]));o&&(x=x.filter(([I])=>I!=="")),r>0&&(x=x.slice(0,r));for(let[I,N]of x)f.push({field:d,[s]:m,value:I===""?"<empty>":I,count:N})}}else for(let a of l){let d=new Map;for(let g of u){let y=g[a],x=y===""||y===null||y===void 0?"":String(y);d.set(x,(d.get(x)||0)+1)}let m=[...d.entries()].sort((g,y)=>y[1]!==g[1]?y[1]-g[1]:g[0].localeCompare(y[0]));o&&(m=m.filter(([g])=>g!=="")),r>0&&(m=m.slice(0,r));for(let[g,y]of m)f.push({field:a,value:g===""?"<empty>":g,count:y})}return{stdout:w(c,f),stderr:"",exitCode:0}}async function re(e,n){let t=[],s=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-s"&&l+1<e.length?t=e[++l].split(","):f.startsWith("-")||s.push(f)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=t.length>0?t:r,u=["field","type","count","min","max","mean"],p=[];for(let l of h){let f=o.map(d=>d[l]).filter(d=>d!=null),c=f.map(d=>typeof d=="number"?d:Number.parseFloat(String(d))).filter(d=>!Number.isNaN(d)),a=c.length===f.length&&c.length>0;p.push({field:l,type:a?"Number":"String",count:f.length,min:a?Math.min(...c):"",max:a?Math.max(...c):"",mean:a?Math.round(c.reduce((d,m)=>d+m,0)/c.length*1e10)/1e10:""})}return{stdout:w(u,p),stderr:"",exitCode:0}}U();function Ge(e){let n=_(e);return O(n)}function nt(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return H(`^${t}$`)}function z(e,n){let t=[],s=new Set;for(let r of e.split(",")){let o=r.trim();if(o.startsWith("!")){let p=o.slice(1),l=z(p,n);for(let f of l)s.add(f);continue}if(o==="*"){for(let p of n)t.includes(p)||t.push(p);continue}if(o.includes("*")){let p=nt(o);for(let l of n)p.test(l)&&!t.includes(l)&&t.push(l);continue}let i=o.match(/^([^:]*):([^:]*)$/);if(i&&(i[1]||i[2])){let p=i[1],l=i[2],f=p?n.indexOf(p):0,c=l?n.indexOf(l):n.length-1;if(f!==-1&&c!==-1){let a=f<=c?1:-1;for(let d=f;a>0?d<=c:d>=c;d+=a)t.includes(n[d])||t.push(n[d])}continue}let h=o.match(/^(\d+)-(\d+)$/);if(h){let p=Number.parseInt(h[1],10),l=Number.parseInt(h[2],10);for(let f=p;f<=l&&f<n.length;f++)t.push(n[f]);continue}let u=Number.parseInt(o,10);if(!Number.isNaN(u)&&u>=0&&u<n.length){t.push(n[u]);continue}n.includes(o)&&t.push(o)}return s.size>0?t.filter(r=>!s.has(r)):t}async function oe(e,n){let t="",s=[];for(let p of e)p.startsWith("-")||(t?s.push(p):t=p);if(!t)return{stdout:"",stderr:`xan select: no columns specified
|
|
8
|
+
`,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=z(t,r),u=o.map(p=>{let l=F();for(let f of h)b(l,f,p[f]);return l});return{stdout:w(h,u),stderr:"",exitCode:0}}async function ie(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan drop: no columns specified
|
|
9
|
+
`,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set(z(t,r)),u=r.filter(l=>!h.has(l)),p=o.map(l=>{let f=F();for(let c of u)b(f,c,l[c]);return f});return{stdout:w(u,p),stderr:"",exitCode:0}}async function ae(e,n){let t="",s="",r=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-s"&&l+1<e.length?s=e[++l]:f.startsWith("-")||(t?r.push(f):t=f)}if(!t)return{stdout:"",stderr:`xan rename: no new name(s) specified
|
|
10
|
+
`,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;let u;if(s){let l=s.split(","),f=t.split(","),c=new Map;for(let a=0;a<l.length&&a<f.length;a++)c.set(l[a],f[a]);u=o.map(a=>c.get(a)||a)}else{let l=t.split(",");u=o.map((f,c)=>c<l.length?l[c]:f)}let p=i.map(l=>{let f=F();for(let c=0;c<o.length;c++)b(f,u[c],l[o[c]]);return f});return{stdout:w(u,p),stderr:"",exitCode:0}}async function le(e,n){let t="index",s=[];for(let p=0;p<e.length;p++)e[p]==="-c"&&p+1<e.length?t=e[++p]:s.push(e[p]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=[t,...r],u=o.map((p,l)=>{let f=F();b(f,t,l);for(let c of r)b(f,c,p[c]);return f});return{stdout:w(h,u),stderr:"",exitCode:0}}async function ue(e,n){let t=e.includes("-j")||e.includes("--just-names"),{headers:s,error:r}=await v(e.filter(i=>i!=="-j"&&i!=="--just-names"),n);return r||{stdout:t?`${s.map(i=>i).join(`
|
|
11
11
|
`)}
|
|
12
12
|
`:`${s.map((i,h)=>`${h} ${i}`).join(`
|
|
13
13
|
`)}
|
|
14
14
|
`,stderr:"",exitCode:0}}async function ce(e,n){let{data:t,error:s}=await v(e,n);return s||{stdout:`${t.length}
|
|
15
|
-
`,stderr:"",exitCode:0}}async function pe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(0,t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function fe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(-t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function de(e,n){let t,s,r,o=[];for(let c=0;c<e.length;c++){let a=e[c];(a==="-s"||a==="--start")&&c+1<e.length?t=Number.parseInt(e[++c],10):(a==="-e"||a==="--end")&&c+1<e.length?s=Number.parseInt(e[++c],10):(a==="-l"||a==="--len")&&c+1<e.length?r=Number.parseInt(e[++c],10):a.startsWith("-")||o.push(a)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=t??0,l;r!==void 0?l=p+r:s!==void 0?l=s:l=h.length;let f=h.slice(p,l);return{stdout:w(i,f),stderr:"",exitCode:0}}async function he(e,n){let{headers:t,data:s,error:r}=await v(e,n);if(r)return r;let o=[...s].reverse();return{stdout:w(t,o),stderr:"",exitCode:0}}var me=Ze(et(),1);async function ge(e,n){let t=e.filter(p=>!p.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);if(o)return o;if(r.length===0){let p=["column"],l=s.map(f=>({column:f}));return{stdout:w(p,l),stderr:"",exitCode:0}}let i=s[0],h=[i,...r.map((p,l)=>String(p[i]??`row_${l}`))],u=[];for(let p=1;p<s.length;p++){let l=s[p],f=
|
|
15
|
+
`,stderr:"",exitCode:0}}async function pe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(0,t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function fe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(-t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function de(e,n){let t,s,r,o=[];for(let c=0;c<e.length;c++){let a=e[c];(a==="-s"||a==="--start")&&c+1<e.length?t=Number.parseInt(e[++c],10):(a==="-e"||a==="--end")&&c+1<e.length?s=Number.parseInt(e[++c],10):(a==="-l"||a==="--len")&&c+1<e.length?r=Number.parseInt(e[++c],10):a.startsWith("-")||o.push(a)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=t??0,l;r!==void 0?l=p+r:s!==void 0?l=s:l=h.length;let f=h.slice(p,l);return{stdout:w(i,f),stderr:"",exitCode:0}}async function he(e,n){let{headers:t,data:s,error:r}=await v(e,n);if(r)return r;let o=[...s].reverse();return{stdout:w(t,o),stderr:"",exitCode:0}}var me=Ze(et(),1);async function ge(e,n){let t=e.filter(p=>!p.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);if(o)return o;if(r.length===0){let p=["column"],l=s.map(f=>({column:f}));return{stdout:w(p,l),stderr:"",exitCode:0}}let i=s[0],h=[i,...r.map((p,l)=>String(p[i]??`row_${l}`))],u=[];for(let p=1;p<s.length;p++){let l=s[p],f=F();b(f,i,l);for(let c=0;c<r.length;c++)b(f,h[c+1],r[c][l]);u.push(f)}return{stdout:w(h,u),stderr:"",exitCode:0}}async function ye(e,n){let t=null,s=[];for(let l=0;l<e.length;l++){let f=e[l];f==="--seed"&&l+1<e.length?t=Number.parseInt(e[++l],10):f.startsWith("-")||s.push(f)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=t!==null?t:Date.now(),u=()=>(h=h*1103515245+12345&2147483647,h/2147483647),p=[...o];for(let l=p.length-1;l>0;l--){let f=Math.floor(u()*(l+1));[p[l],p[f]]=[p[f],p[l]]}return{stdout:w(r,p),stderr:"",exitCode:0}}async function xe(e,n){let t=null,s="",r=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-l"||d==="--length")&&a+1<e.length?t=Number.parseInt(e[++a],10):(d==="-d"||d==="--default")&&a+1<e.length?s=e[++a]:d.startsWith("-")||r.push(d)}let o=r[0],i;if(!o||o==="-")i=n.stdin;else try{let a=n.fs.resolvePath(n.cwd,o);i=await n.fs.readFile(a)}catch{return{stdout:"",stderr:`xan fixlengths: ${o}: No such file or directory
|
|
16
16
|
`,exitCode:1}}let u=me.default.parse(i.trim(),{header:!1,skipEmptyLines:!0}).data;if(u.length===0)return{stdout:"",stderr:"",exitCode:0};let p=Math.max(...u.map(a=>a.length)),l=t??p,f=u.map(a=>a.length===l?a:a.length<l?[...a,...Array(l-a.length).fill(s)]:a.slice(0,l));return{stdout:`${me.default.unparse(f).replace(/\r\n/g,`
|
|
17
17
|
`)}
|
|
18
18
|
`,stderr:"",exitCode:0}}async function we(e,n){let t=null,s=null,r=".",o=[];for(let c=0;c<e.length;c++){let a=e[c];(a==="-c"||a==="--chunks")&&c+1<e.length?t=Number.parseInt(e[++c],10):(a==="-S"||a==="--size")&&c+1<e.length?s=Number.parseInt(e[++c],10):(a==="-o"||a==="--output")&&c+1<e.length?r=e[++c]:a.startsWith("-")||o.push(a)}if(!t&&!s)return{stdout:"",stderr:`xan split: must specify -c or -S
|
|
@@ -32,22 +32,22 @@ import{a as O,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-GZHFXDDO
|
|
|
32
32
|
`,exitCode:1}}async function rt(e,n){let t=e[0],s;if(!t||t==="-")s=n.stdin;else try{let r=n.fs.resolvePath(n.cwd,t);s=await n.fs.readFile(r)}catch{return{stdout:"",stderr:`xan from: ${t}: No such file or directory
|
|
33
33
|
`,exitCode:1}}try{let r=JSON.parse(s.trim());if(!Array.isArray(r))return{stdout:"",stderr:`xan from: JSON input must be an array
|
|
34
34
|
`,exitCode:1};if(r.length===0)return{stdout:`
|
|
35
|
-
`,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[i,...h]=r,u=h.map(p=>{let l=
|
|
35
|
+
`,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[i,...h]=r,u=h.map(p=>{let l=F();for(let f=0;f<i.length;f++)b(l,i[f],p[f]);return l});return{stdout:w(i,u),stderr:"",exitCode:0}}let o=Object.keys(r[0]).sort();return{stdout:w(o,r),stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`xan from: invalid JSON input
|
|
36
36
|
`,exitCode:1}}}async function Se(e,n){let t=!1,s=0,r="",o=[];for(let c=0;c<e.length;c++){let a=e[c];if(a==="-v"||a==="--invert")t=!0;else if((a==="-l"||a==="--limit")&&c+1<e.length)s=Number.parseInt(e[++c],10);else{if(a==="--help")return D({name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output to N rows"," --help display help"]});a.startsWith("-")||(r?o.push(a):r=a)}}if(!r)return{stdout:"",stderr:`xan filter: no expression specified
|
|
37
37
|
`,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=Ge(r),f=[];for(let c of h){if(s>0&&f.length>=s)break;let a=$(c,l,p),d=a.length>0&&a.some(m=>!!m);(t?!d:d)&&f.push(c)}return{stdout:w(i,f),stderr:"",exitCode:0}}async function Ie(e,n){let t="",s=!1,r=!1,o=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-N"||f==="--numeric"?s=!0:f==="-R"||f==="-r"||f==="--reverse"?r=!0:f==="-s"&&l+1<e.length?t=e[++l]:f.startsWith("-")||o.push(f)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;!t&&i.length>0&&(t=i[0]);let p=[...h].sort((l,f)=>{let c=l[t],a=f[t],d;if(s){let m=typeof c=="number"?c:Number.parseFloat(String(c)),g=typeof a=="number"?a:Number.parseFloat(String(a));d=m-g}else d=String(c).localeCompare(String(a));return r?-d:d});return{stdout:w(i,p),stderr:"",exitCode:0}}async function ke(e,n){let t="",s=[];for(let p=0;p<e.length;p++){let l=e[p];l==="-s"&&p+1<e.length?t=e[++p]:l.startsWith("-")||s.push(l)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set,u=o.filter(p=>{let l=t?String(p[t]):JSON.stringify(p);return h.has(l)?!1:(h.add(l),!0)});return{stdout:w(r,u),stderr:"",exitCode:0}}async function Ne(e,n){let t=10,s="",r=!1,o=[];for(let f=0;f<e.length;f++){let c=e[f];(c==="-l"||c==="-n")&&f+1<e.length?t=Number.parseInt(e[++f],10):c==="-R"||c==="-r"||c==="--reverse"?r=!0:c.startsWith("-")||(s?o.push(c):s=c)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;!s&&i.length>0&&(s=i[0]);let l=[...h].sort((f,c)=>{let a=f[s],d=c[s],m=typeof a=="number"?a:Number.parseFloat(String(a)),g=typeof d=="number"?d:Number.parseFloat(String(d));return r?m-g:g-m}).slice(0,t);return{stdout:w(i,l),stderr:"",exitCode:0}}U();async function Ee(e,n){let t="",s=!1,r=!1,o=[];for(let d=0;d<e.length;d++){let m=e[d];m==="-O"||m==="--overwrite"?s=!0:m==="--filter"?r=!0:m.startsWith("-")||(t?o.push(m):t=m)}if(!t)return{stdout:"",stderr:`xan map: no expression specified
|
|
38
|
-
`,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let l=V(t).map(({expr:d,name:m})=>({alias:typeof m=="string"?m:m[0],ast:
|
|
38
|
+
`,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let l=V(t).map(({expr:d,name:m})=>({alias:typeof m=="string"?m:m[0],ast:O(d)})),f={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},c;if(s){c=[...i];for(let d of l)i.includes(d.alias)||c.push(d.alias)}else c=[...i,...l.map(d=>d.alias)];let a=[];for(let d=0;d<h.length;d++){let m=h[d],g=M(m),y=!1,x=Object.assign(G(m),{_row_index:d});for(let I of l){let N=$(x,I.ast,f),C=N.length>0?N[0]:null;if(r&&C==null){y=!0;break}b(g,I.alias,C)}y||a.push(g)}return{stdout:w(c,a),stderr:"",exitCode:0}}async function Ae(e,n){let t="",s="",r="",o=[];for(let m=0;m<e.length;m++){let g=e[m];(g==="-r"||g==="--rename")&&m+1<e.length?r=e[++m]:g.startsWith("-")||(t?s?o.push(g):s=g:t=g)}if(!t||!s)return{stdout:"",stderr:`xan transform: usage: xan transform COLUMN EXPR [FILE]
|
|
39
39
|
`,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=t.split(",").map(m=>m.trim()),l=r?r.split(",").map(m=>m.trim()):[];for(let m of p)if(!i.includes(m))return{stdout:"",stderr:`xan transform: column '${m}' not found
|
|
40
|
-
`,exitCode:1};let f=
|
|
40
|
+
`,exitCode:1};let f=O(V(s)[0]?.expr||(U(),Qe(He)).parseMoonblade(s)),c={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},a=i.map(m=>{let g=p.indexOf(m);return g!==-1&&l[g]?l[g]:m}),d=[];for(let m of h){let g=M(m);for(let y=0;y<p.length;y++){let x=p[y],I=Object.assign(G(m),{_:m[x]}),N=$(I,f,c),C=N.length>0?N[0]:null,A=l[y]||x;A!==x&&delete g[x],b(g,A,C)}d.push(g)}return{stdout:w(a,d),stderr:"",exitCode:0}}async function Fe(e,n){let t="",s="|",r=!1,o="",i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--separator")&&a+1<e.length?s=e[++a]:d==="--drop-empty"?r=!0:(d==="-r"||d==="--rename")&&a+1<e.length?o=e[++a]:d.startsWith("-")||(t?i.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan explode: usage: xan explode COLUMN [FILE]
|
|
41
41
|
`,exitCode:1};let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;if(!h.includes(t))return{stdout:"",stderr:`xan explode: column '${t}' not found
|
|
42
|
-
`,exitCode:1};let l=o?h.map(a=>a===t?o:a):h,f=o||t,c=[];for(let a of u){let d=a[t],m=d==null?"":String(d);if(m===""){if(!r){let g=M(a);o&&(delete g[t],b(g,f,"")),c.push(g)}}else{let g=m.split(s);for(let y of g){let x=M(a);o&&delete x[t],b(x,f,y),c.push(x)}}}return{stdout:w(l,c),stderr:"",exitCode:0}}async function
|
|
42
|
+
`,exitCode:1};let l=o?h.map(a=>a===t?o:a):h,f=o||t,c=[];for(let a of u){let d=a[t],m=d==null?"":String(d);if(m===""){if(!r){let g=M(a);o&&(delete g[t],b(g,f,"")),c.push(g)}}else{let g=m.split(s);for(let y of g){let x=M(a);o&&delete x[t],b(x,f,y),c.push(x)}}}return{stdout:w(l,c),stderr:"",exitCode:0}}async function Oe(e,n){let t="",s="|",r="",o=[];for(let g=0;g<e.length;g++){let y=e[g];(y==="-s"||y==="--sep")&&g+1<e.length?s=e[++g]:(y==="-r"||y==="--rename")&&g+1<e.length?r=e[++g]:y.startsWith("-")||(t?o.push(y):t=y)}if(!t)return{stdout:"",stderr:`xan implode: usage: xan implode COLUMN [FILE]
|
|
43
43
|
`,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;if(!i.includes(t))return{stdout:"",stderr:`xan implode: column '${t}' not found
|
|
44
44
|
`,exitCode:1};let p=i.filter(g=>g!==t),l=r?i.map(g=>g===t?r:g):i,f=r||t,c=[],a=null,d=[],m=null;for(let g of h){let y=p.map(N=>String(g[N]??"")).join("\0"),x=g[t],I=x==null?"":String(x);if(y!==a){if(m!==null){let N=M(m);r&&delete N[t],b(N,f,d.join(s)),c.push(N)}a=y,d=[I],m=g}else d.push(I)}if(m!==null){let g=M(m);r&&delete g[t],b(g,f,d.join(s)),c.push(g)}return{stdout:w(l,c),stderr:"",exitCode:0}}async function Le(e,n){let t="",s="",r="",o="",i="inner",h="",u=0;for(let C=0;C<e.length;C++){let A=e[C];A==="--left"?i="left":A==="--right"?i="right":A==="--full"?i="full":(A==="-D"||A==="--default")&&C+1<e.length?h=e[++C]:A.startsWith("-")||(u++,u===1?t=A:u===2?s=A:u===3?r=A:u===4&&(o=A))}if(!t||!s||!r||!o)return{stdout:"",stderr:`xan join: usage: xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]
|
|
45
45
|
`,exitCode:1};let p=await v([s],n);if(p.error)return p.error;let l=await v([o],n);if(l.error)return l.error;let{headers:f,data:c}=p,{headers:a,data:d}=l;if(!f.includes(t))return{stdout:"",stderr:`xan join: column '${t}' not found in first file
|
|
46
46
|
`,exitCode:1};if(!a.includes(r))return{stdout:"",stderr:`xan join: column '${r}' not found in second file
|
|
47
|
-
`,exitCode:1};let m=new Map;for(let C of d){let A=String(C[r]??"");m.has(A)||m.set(A,[]),m.get(A)?.push(C)}let g=new Set(f),y=a.filter(C=>!g.has(C)),x=[...f,...y],I=[],N=new Set;for(let C of c){let A=String(C[t]??""),j=m.get(A);if(j&&j.length>0){N.add(A);for(let L of j){let T=
|
|
47
|
+
`,exitCode:1};let m=new Map;for(let C of d){let A=String(C[r]??"");m.has(A)||m.set(A,[]),m.get(A)?.push(C)}let g=new Set(f),y=a.filter(C=>!g.has(C)),x=[...f,...y],I=[],N=new Set;for(let C of c){let A=String(C[t]??""),j=m.get(A);if(j&&j.length>0){N.add(A);for(let L of j){let T=F();for(let W of f)b(T,W,C[W]);for(let W of y)b(T,W,L[W]);I.push(T)}}else if(i==="left"||i==="full"){let L=F();for(let T of f)b(L,T,C[T]);for(let T of y)b(L,T,h);I.push(L)}}if(i==="right"||i==="full")for(let C of d){let A=String(C[r]??"");if(!N.has(A)){let j=F();for(let L of f)b(j,L,a.includes(L)?C[L]:h);for(let L of y)b(j,L,C[L]);I.push(j)}}return{stdout:w(x,I),stderr:"",exitCode:0}}async function Pe(e,n){let t="",s="",r=[],o=[];for(let y=0;y<e.length;y++){let x=e[y];(x==="-g"||x==="--groupby")&&y+1<e.length?r=e[++y].split(",").map(I=>I.trim()):x.startsWith("-")||(t?s?o.push(x):s=x:t=x)}if(!t||!s)return{stdout:"",stderr:`xan pivot: usage: xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]
|
|
48
48
|
`,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;if(!i.includes(t))return{stdout:"",stderr:`xan pivot: column '${t}' not found
|
|
49
49
|
`,exitCode:1};let p=s.match(/^(\w+)\((\w+)\)$/);if(!p)return{stdout:"",stderr:`xan pivot: invalid aggregation expression '${s}'
|
|
50
|
-
`,exitCode:1};let[,l,f]=p;r.length===0&&(r=i.filter(y=>y!==t&&y!==f));let c=[];for(let y of h){let x=String(y[t]??"");c.includes(x)||c.push(x)}let a=new Map,d=[];for(let y of h){let x=r.map(A=>String(y[A]??"")).join("\0"),I=String(y[t]??""),N=y[f];a.has(x)||(a.set(x,new Map),d.push(x));let C=a.get(x);C&&(C.has(I)||C.set(I,[]),C.get(I)?.push(N))}let m=[...r,...c],g=[];for(let y of d){let x=y.split("\0"),I=a.get(y);if(!I)continue;let N=
|
|
50
|
+
`,exitCode:1};let[,l,f]=p;r.length===0&&(r=i.filter(y=>y!==t&&y!==f));let c=[];for(let y of h){let x=String(y[t]??"");c.includes(x)||c.push(x)}let a=new Map,d=[];for(let y of h){let x=r.map(A=>String(y[A]??"")).join("\0"),I=String(y[t]??""),N=y[f];a.has(x)||(a.set(x,new Map),d.push(x));let C=a.get(x);C&&(C.has(I)||C.set(I,[]),C.get(I)?.push(N))}let m=[...r,...c],g=[];for(let y of d){let x=y.split("\0"),I=a.get(y);if(!I)continue;let N=F();for(let C=0;C<r.length;C++)b(N,r[C],x[C]);for(let C of c){let A=I.get(C)||[];b(N,C,ot(l,A))}g.push(N)}return{stdout:w(m,g),stderr:"",exitCode:0}}function ot(e,n){let t=n.filter(s=>s!=null).map(s=>typeof s=="number"?s:Number.parseFloat(String(s))).filter(s=>!Number.isNaN(s));switch(e){case"count":return n.length;case"sum":return t.reduce((s,r)=>s+r,0);case"mean":case"avg":return t.length>0?t.reduce((s,r)=>s+r,0)/t.length:null;case"min":return t.length>0?Math.min(...t):null;case"max":return t.length>0?Math.max(...t):null;case"first":return n.length>0?String(n[0]??""):null;case"last":return n.length>0?String(n[n.length-1]??""):null;default:return null}}async function Re(e,n){let t="",s=[];for(let h=0;h<e.length;h++){let u=e[h];(u==="-s"||u==="--sort")&&h+1<e.length?t=e[++h]:u.startsWith("-")||s.push(u)}if(s.length<2)return{stdout:"",stderr:`xan merge: usage: xan merge [OPTIONS] FILE1 FILE2 ...
|
|
51
51
|
`,exitCode:1};let r=[],o=null;for(let h of s){let u=await v([h],n);if(u.error)return u.error;if(o===null)o=u.headers;else if(JSON.stringify(o)!==JSON.stringify(u.headers))return{stdout:"",stderr:`xan merge: all files must have the same headers
|
|
52
52
|
`,exitCode:1};r.push({headers:u.headers,data:u.data})}if(!o)return{stdout:"",stderr:"",exitCode:0};let i=[];for(let{data:h}of r)i=i.concat(h);if(t){if(!o.includes(t))return{stdout:"",stderr:`xan merge: column '${t}' not found
|
|
53
53
|
`,exitCode:1};i.sort((h,u)=>{let p=h[t],l=u[t],f=typeof p=="number"?p:Number.parseFloat(String(p)),c=typeof l=="number"?l:Number.parseFloat(String(l));return!Number.isNaN(f)&&!Number.isNaN(c)?f-c:String(p??"").localeCompare(String(l??""))})}return{stdout:w(o,i),stderr:"",exitCode:0}}U();async function Me(e,n){let t=e.filter(u=>!u.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);return o||(r.length===0?{stdout:"",stderr:"",exitCode:0}:{stdout:r.map(u=>s.map(p=>u[p])).map(u=>u.map(p=>it(p)).join(",")).join(`
|
|
@@ -56,10 +56,10 @@ import{a as O,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-GZHFXDDO
|
|
|
56
56
|
`)?`"${n.replace(/"/g,'""')}"`:n}async function $e(e,n){let t=null,s=null,r=[];for(let c=0;c<e.length;c++){let a=e[c];if(a==="--seed"&&c+1<e.length)s=Number.parseInt(e[++c],10);else if(!a.startsWith("-")){let d=Number.parseInt(a,10);t===null&&!Number.isNaN(d)&&d>0?t=d:r.push(a)}}if(t===null)return{stdout:"",stderr:`xan sample: usage: xan sample <sample-size> [FILE]
|
|
57
57
|
`,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;if(i.length<=t)return{stdout:w(o,i),stderr:"",exitCode:0};let u=s!==null?s:Date.now(),p=()=>(u=u*1103515245+12345&2147483647,u/2147483647),l=i.map((c,a)=>a);for(let c=l.length-1;c>0;c--){let a=Math.floor(p()*(c+1));[l[c],l[a]]=[l[a],l[c]]}let f=l.slice(0,t).sort((c,a)=>c-a).map(c=>i[c]);return{stdout:w(o,f),stderr:"",exitCode:0}}async function Te(e,n){let t=!1,s=[];for(let u=0;u<e.length;u++){let p=e[u];p==="-p"||p==="--pad"?t=!0:p.startsWith("-")||s.push(p)}if(s.length===0)return{stdout:"",stderr:`xan cat: no files specified
|
|
58
58
|
`,exitCode:1};let r=await We(n,s,{cmdName:"xan cat",stopOnError:!0});if(r.exitCode!==0)return{stdout:"",stderr:r.stderr,exitCode:r.exitCode};let o=[],i=[];for(let{content:u}of r.files){let{headers:p,data:l}=qe(u);o.push({headers:p,data:l});for(let f of p)i.includes(f)||i.push(f)}if(!t){let u=JSON.stringify(o[0].headers);for(let p=1;p<o.length;p++)if(JSON.stringify(o[p].headers)!==u)return{stdout:"",stderr:`xan cat: headers do not match (use -p to pad)
|
|
59
|
-
`,exitCode:1};i=o[0].headers}let h=[];for(let{headers:u,data:p}of o)for(let l of p){let f=
|
|
59
|
+
`,exitCode:1};i=o[0].headers}let h=[];for(let{headers:u,data:p}of o)for(let l of p){let f=F();for(let c of i)b(f,c,u.includes(c)?l[c]:"");h.push(f)}return{stdout:w(i,h),stderr:"",exitCode:0}}async function je(e,n){let t="",s=[],r=!1,o=!1,i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--select")&&a+1<e.length?s=e[++a].split(","):d==="-v"||d==="--invert"?r=!0:d==="-i"||d==="--ignore-case"?o=!0:d==="-r"||d==="--regex"||d.startsWith("-")||(t?i.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan search: no pattern specified
|
|
60
60
|
`,exitCode:1};let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;let l=s.length>0?s:h,f;try{f=H(t,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${t}'
|
|
61
61
|
`,exitCode:1}}let c=u.filter(a=>{let d=l.some(m=>{let g=a[m];return g!=null&&f.test(String(g))});return r?!d:d});return{stdout:w(h,c),stderr:"",exitCode:0}}async function De(e,n){let t="",s=[];for(let c of e)c.startsWith("-")||(t?s.push(c):t=c);if(!t)return{stdout:"",stderr:`xan flatmap: no expression specified
|
|
62
|
-
`,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let u=V(t).map(({expr:c,name:a})=>({alias:typeof a=="string"?a:a[0],ast:
|
|
62
|
+
`,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let u=V(t).map(({expr:c,name:a})=>({alias:typeof a=="string"?a:a[0],ast:O(c)})),p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=[...r,...u.map(c=>c.alias)],f=[];for(let c of o){let a=[],d=1;for(let m of u){let g=$(c,m.ast,p),y=g.length>0&&Array.isArray(g[0])?g[0]:g;a.push(y),d=Math.max(d,y.length)}for(let m=0;m<d;m++){let g=M(c);for(let y=0;y<u.length;y++){let x=a[y][m]??null;b(g,u[y].alias,x)}f.push(g)}}return{stdout:w(l,f),stderr:"",exitCode:0}}async function Ve(e,n){let{cmdView:t}=await import("./xan-view-5SZBYPLG.js");return t(e,n)}var Ye=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),at=new Set(["agg","behead","cat","count","dedup","drop","enum","explode","f","filter","fixlengths","flatmap","flatten","fmt","frequency","freq","from","groupby","head","headers","implode","join","map","merge","partition","pivot","rename","reverse","sample","search","select","shuffle","slice","sort","split","stats","tail","to","top","transform","transpose","view",...Ye]),Xe={name:"xan",summary:"CSV toolkit for data manipulation",usage:"xan <COMMAND> [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data.
|
|
63
63
|
It provides a simple, ergonomic interface for common data operations.
|
|
64
64
|
|
|
65
65
|
COMMANDS:
|
|
@@ -134,7 +134,7 @@ EXAMPLES:
|
|
|
134
134
|
xan explode tags data.csv
|
|
135
135
|
xan join id file1.csv id file2.csv
|
|
136
136
|
xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},lt={headers:{name:"xan headers",summary:"Show column names",usage:"xan headers [OPTIONS] [FILE]",description:"Display column names from a CSV file.",options:["-j, --just-names show names only (no index)"]},count:{name:"xan count",summary:"Count rows",usage:"xan count [FILE]",description:"Count the number of data rows (excluding header).",options:[]},filter:{name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output rows"]},search:{name:"xan search",summary:"Filter rows by regex",usage:"xan search [OPTIONS] PATTERN [FILE]",description:"Filter CSV rows by regex match on columns.",options:["-s, --select COLS search only these columns","-v, --invert invert match","-i, --ignore-case case insensitive"]},select:{name:"xan select",summary:"Select columns",usage:"xan select COLS [FILE]",description:"Select columns by name, index, glob, or range.",options:["Supports: col names, indices (0,1), ranges (a:c), globs (vec_*), negation (!col)"]},explode:{name:"xan explode",summary:"Split column into rows",usage:"xan explode COLUMN [OPTIONS] [FILE]",description:"Split delimited column values into multiple rows.",options:["-s, --separator SEP separator (default: |)","--drop-empty drop empty values","-r, --rename NAME rename column"]},implode:{name:"xan implode",summary:"Combine rows",usage:"xan implode COLUMN [OPTIONS] [FILE]",description:"Combine consecutive rows, joining column values.",options:["-s, --sep SEP separator (default: |)","-r, --rename NAME rename column"]},join:{name:"xan join",summary:"Join CSV files",usage:"xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]",description:"Join two CSV files on key columns.",options:["--left left outer join","--right right outer join","--full full outer join","-D, --default VAL default for missing"]},pivot:{name:"xan pivot",summary:"Reshape to columns",usage:"xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]",description:"Turn row values into columns.",options:["-g, --groupby COLS group by columns"]}},cn={name:"xan",async execute(e,n){if(e.length===0||K(e))return D(Xe);let t=e[0],s=e.slice(1);if(K(s)){let r=lt[t];return r?D(r):D(Xe)}if(Ye.has(t))return{stdout:"",stderr:`xan ${t}: not yet implemented
|
|
137
|
-
`,exitCode:1};switch(t){case"headers":return ue(s,n);case"count":return ce(s,n);case"head":return pe(s,n);case"tail":return fe(s,n);case"slice":return de(s,n);case"reverse":return he(s,n);case"behead":return Me(s,n);case"sample":return $e(s,n);case"select":return oe(s,n);case"drop":return ie(s,n);case"rename":return ae(s,n);case"enum":return le(s,n);case"filter":return Se(s,n);case"search":return je(s,n);case"sort":return Ie(s,n);case"dedup":return ke(s,n);case"top":return Ne(s,n);case"map":return Ee(s,n);case"transform":return Ae(s,n);case"explode":return
|
|
137
|
+
`,exitCode:1};switch(t){case"headers":return ue(s,n);case"count":return ce(s,n);case"head":return pe(s,n);case"tail":return fe(s,n);case"slice":return de(s,n);case"reverse":return he(s,n);case"behead":return Me(s,n);case"sample":return $e(s,n);case"select":return oe(s,n);case"drop":return ie(s,n);case"rename":return ae(s,n);case"enum":return le(s,n);case"filter":return Se(s,n);case"search":return je(s,n);case"sort":return Ie(s,n);case"dedup":return ke(s,n);case"top":return Ne(s,n);case"map":return Ee(s,n);case"transform":return Ae(s,n);case"explode":return Fe(s,n);case"implode":return Oe(s,n);case"flatmap":return De(s,n);case"pivot":return Pe(s,n);case"agg":return te(s,n);case"groupby":return ne(s,n);case"frequency":case"freq":return se(s,n);case"stats":return re(s,n);case"cat":return Te(s,n);case"join":return Le(s,n);case"merge":return Re(s,n);case"split":return we(s,n);case"partition":return ve(s,n);case"to":return Ce(s,n);case"from":return be(s,n);case"transpose":return ge(s,n);case"shuffle":return ye(s,n);case"fixlengths":return xe(s,n);case"view":return Y(s,n);case"flatten":case"f":return X(s,n);case"fmt":return Ve(s,n);default:return at.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented
|
|
138
138
|
`,exitCode:1}:{stdout:"",stderr:`xan: unknown command '${t}'
|
|
139
139
|
Run 'xan --help' for usage.
|
|
140
|
-
`,exitCode:1}}}};export{cn as
|
|
140
|
+
`,exitCode:1}}}},pn={name:"xan",flags:[],stdinType:"text",needsArgs:!0};export{cn as a,pn as b};
|
|
@@ -15,7 +15,7 @@ import{a as Ce,b as Fe,c as ne}from"./chunk-GTNBSMZR.js";import{a as G,c as B,e
|
|
|
15
15
|
`:`${c}: ${l}
|
|
16
16
|
`}catch{o+=t?`cannot open
|
|
17
17
|
`:`${c}: cannot open (No such file or directory)
|
|
18
|
-
`,s=1}return{stdout:o,stderr:"",exitCode:s}}};export{Dr as
|
|
18
|
+
`,s=1}return{stdout:o,stderr:"",exitCode:s}}},Mr={name:"file",flags:[{flag:"-b",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-L",type:"boolean"}],needsArgs:!0};export{Dr as a,Mr as b};
|
|
19
19
|
/*! Bundled license information:
|
|
20
20
|
|
|
21
21
|
ieee754/index.js:
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as c}from"./chunk-4PRVMER6.js";var C={name:"time",async execute(i,r){let a="%e %M",o=null,d=!1,m=!1,t=0;for(;t<i.length;){let e=i[t];if(e==="-f"||e==="--format"){if(t++,t>=i.length)return{stdout:"",stderr:`time: missing argument to '-f'
|
|
3
3
|
`,exitCode:1};a=i[t],t++}else if(e==="-o"||e==="--output"){if(t++,t>=i.length)return{stdout:"",stderr:`time: missing argument to '-o'
|
|
4
4
|
`,exitCode:1};o=i[t],t++}else if(e==="-a"||e==="--append")d=!0,t++;else if(e==="-v"||e==="--verbose")a=`Command being timed: %C
|
|
5
5
|
Elapsed (wall clock) time: %e seconds
|
|
6
|
-
Maximum resident set size (kbytes): %M`,t++;else if(e==="-p"||e==="--portability")m=!0,t++;else if(e==="--"){t++;break}else if(e.startsWith("-"))t++;else break}let f=i.slice(t);if(f.length===0)return{stdout:"",stderr:"",exitCode:0};let p=performance.now(),
|
|
7
|
-
`,exitCode:1};s=await r.exec(
|
|
6
|
+
Maximum resident set size (kbytes): %M`,t++;else if(e==="-p"||e==="--portability")m=!0,t++;else if(e==="--"){t++;break}else if(e.startsWith("-"))t++;else break}let f=i.slice(t);if(f.length===0)return{stdout:"",stderr:"",exitCode:0};let p=performance.now(),u=f.join(" "),s;try{if(!r.exec)return{stdout:"",stderr:`time: exec not available
|
|
7
|
+
`,exitCode:1};s=await r.exec(u,{env:c(r.env),cwd:r.cwd})}catch(e){s={stdout:"",stderr:`time: ${e.message}
|
|
8
8
|
`,exitCode:127}}let l=(performance.now()-p)/1e3,n;if(m?n=`real ${l.toFixed(2)}
|
|
9
9
|
user 0.00
|
|
10
10
|
sys 0.00
|
|
11
|
-
`:(n=a.replace(/%e/g,l.toFixed(2)).replace(/%E/g,w(l)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,
|
|
11
|
+
`:(n=a.replace(/%e/g,l.toFixed(2)).replace(/%E/g,w(l)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,u),n.endsWith(`
|
|
12
12
|
`)||(n+=`
|
|
13
13
|
`)),o)try{let e=r.fs.resolvePath(r.cwd,o);if(d&&await r.fs.exists(e)){let g=await r.fs.readFile(e);await r.fs.writeFile(e,g+n)}else await r.fs.writeFile(e,n)}catch(e){return{stdout:s.stdout,stderr:s.stderr+`time: cannot write to '${o}': ${e.message}
|
|
14
|
-
`,exitCode:s.exitCode}}else s={...s,stderr:s.stderr+n};return s}};function w(i){let r=Math.floor(i/3600),a=Math.floor(i%3600/60),o=i%60;return r>0?`${r}:${a.toString().padStart(2,"0")}:${o.toFixed(2).padStart(5,"0")}`:`${a}:${o.toFixed(2).padStart(5,"0")}`}export{C as
|
|
14
|
+
`,exitCode:s.exitCode}}else s={...s,stderr:s.stderr+n};return s}};function w(i){let r=Math.floor(i/3600),a=Math.floor(i%3600/60),o=i%60;return r>0?`${r}:${a.toString().padStart(2,"0")}:${o.toFixed(2).padStart(5,"0")}`:`${a}:${o.toFixed(2).padStart(5,"0")}`}var F={name:"time",flags:[{flag:"-p",type:"boolean"}],needsArgs:!0};export{C as a,F as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{b as g}from"./chunk-5WFYIUU2.js";import{a as d}from"./chunk-JBABAK44.js";import{a as p,b as f}from"./chunk-GTNBSMZR.js";var O={name:"uniq",summary:"report or omit repeated lines",usage:"uniq [OPTION]... [INPUT [OUTPUT]]",options:["-c, --count prefix lines by the number of occurrences","-d, --repeated only print duplicate lines","-i, --ignore-case ignore case when comparing","-u, --unique only print unique lines"," --help display this help and exit"]},w={count:{short:"c",long:"count",type:"boolean"},duplicatesOnly:{short:"d",long:"repeated",type:"boolean"},uniqueOnly:{short:"u",long:"unique",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},N={name:"uniq",async execute(c,m){if(f(c))return p(O);let o=d("uniq",c,w);if(!o.ok)return o.error;let{count:y,duplicatesOnly:h,uniqueOnly:q,ignoreCase:b}=o.result.flags,C=o.result.positional,s=await g(m,C,{cmdName:"uniq"});if(!s.ok)return s.error;let n=s.content.split(`
|
|
3
|
+
`);if(n.length>0&&n[n.length-1]===""&&n.pop(),n.length===0)return{stdout:"",stderr:"",exitCode:0};let t=[],r=n[0],i=1,x=(e,l)=>b?e.toLowerCase()===l.toLowerCase():e===l;for(let e=1;e<n.length;e++)x(n[e],r)?i++:(t.push({line:r,count:i}),r=n[e],i=1);t.push({line:r,count:i});let u=t;h?u=t.filter(e=>e.count>1):q&&(u=t.filter(e=>e.count===1));let a="";for(let{line:e,count:l}of u)y?a+=`${String(l).padStart(4)} ${e}
|
|
4
|
+
`:a+=`${e}
|
|
5
|
+
`;return{stdout:a,stderr:"",exitCode:0}}},P={name:"uniq",flags:[{flag:"-c",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-i",type:"boolean"}],stdinType:"text",needsFiles:!0};export{N as a,P as b};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b as o}from"./chunk-GTNBSMZR.js";
|
|
2
|
+
import{a,b as o}from"./chunk-GTNBSMZR.js";var l={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
|
|
3
3
|
s - seconds (default)
|
|
4
4
|
m - minutes
|
|
5
5
|
h - hours
|
|
6
6
|
d - days
|
|
7
7
|
|
|
8
|
-
NUMBER may be a decimal number.`,options:[" --help display this help and exit"]};function
|
|
9
|
-
`,exitCode:1};let e=0;for(let n of t){let r=
|
|
10
|
-
`,exitCode:1};e+=r}return s.sleep?await s.sleep(e):await new Promise(n=>setTimeout(n,e)),{stdout:"",stderr:"",exitCode:0}}};export{d as
|
|
8
|
+
NUMBER may be a decimal number.`,options:[" --help display this help and exit"]};function i(t){let s=t.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!s)return null;let e=parseFloat(s[1]);switch(s[2]||"s"){case"s":return e*1e3;case"m":return e*60*1e3;case"h":return e*60*60*1e3;case"d":return e*24*60*60*1e3;default:return null}}var d={name:"sleep",async execute(t,s){if(o(t))return a(l);if(t.length===0)return{stdout:"",stderr:`sleep: missing operand
|
|
9
|
+
`,exitCode:1};let e=0;for(let n of t){let r=i(n);if(r===null)return{stdout:"",stderr:`sleep: invalid time interval '${n}'
|
|
10
|
+
`,exitCode:1};e+=r}return s.sleep?await s.sleep(e):await new Promise(n=>setTimeout(n,e)),{stdout:"",stderr:"",exitCode:0}}},m={name:"sleep",flags:[],needsArgs:!0};export{d as a,m as b};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as g}from"./chunk-JBABAK44.js";import{a as D,b as $}from"./chunk-GTNBSMZR.js";var P={name:"tree",summary:"list contents of directories in a tree-like format",usage:"tree [OPTION]... [DIRECTORY]...",options:["-a include hidden files","-d list directories only","-L LEVEL limit depth of directory tree","-f print full path prefix for each file"," --help display this help and exit"]},b={showHidden:{short:"a",type:"boolean"},directoriesOnly:{short:"d",type:"boolean"},fullPath:{short:"f",type:"boolean"},maxDepth:{short:"L",type:"number"}},O={name:"tree",async execute(i,o){if($(i))return D(P);let s=g("tree",i,b);if(!s.ok)return s.error;let f={showHidden:s.result.flags.showHidden,directoriesOnly:s.result.flags.directoriesOnly,maxDepth:s.result.flags.maxDepth??null,fullPath:s.result.flags.fullPath},d=s.result.positional;d.length===0&&d.push(".");let e="",l="",a=0,n=0;for(let t of d){let r=await T(o,t,f,"",0);e+=r.output,l+=r.stderr,a+=r.dirCount,n+=r.fileCount}return e+=`
|
|
3
|
+
${a} director${a===1?"y":"ies"}`,f.directoriesOnly||(e+=`, ${n} file${n===1?"":"s"}`),e+=`
|
|
4
|
+
`,{stdout:e,stderr:l,exitCode:l?1:0}}};async function T(i,o,s,f,d){let e={output:"",stderr:"",dirCount:0,fileCount:0},l=i.fs.resolvePath(i.cwd,o);try{if(!(await i.fs.stat(l)).isDirectory)return e.output=`${o}
|
|
5
|
+
`,e.fileCount=1,e}catch{return e.stderr=`tree: ${o}: No such file or directory
|
|
6
|
+
`,e}if(e.output=`${o}
|
|
7
|
+
`,s.maxDepth!==null&&d>=s.maxDepth)return e;try{let a=[];if(i.fs.readdirWithFileTypes)a=(await i.fs.readdirWithFileTypes(l)).map(r=>({name:r.name,isDirectory:r.isDirectory}));else{let t=await i.fs.readdir(l);for(let r=0;r<t.length;r+=100){let m=t.slice(r,r+100),u=await Promise.all(m.map(async c=>{let y=l==="/"?`/${c}`:`${l}/${c}`;try{let h=await i.fs.stat(y);return{name:c,isDirectory:h.isDirectory}}catch{return null}}));a.push(...u.filter(c=>c!==null))}}let n=a.filter(t=>!(!s.showHidden&&t.name.startsWith(".")||s.directoriesOnly&&!t.isDirectory));n.sort((t,r)=>t.name.localeCompare(r.name));for(let t=0;t<n.length;t++){let r=n[t],m=l==="/"?`/${r.name}`:`${l}/${r.name}`,u=t===n.length-1,c=u?"`-- ":"|-- ",y=f+(u?" ":"| ");if(r.isDirectory){e.dirCount++;let h=s.fullPath?m:r.name;if(e.output+=`${f+c+h}
|
|
8
|
+
`,s.maxDepth===null||d+1<s.maxDepth){let C=await w(i,m,s,y,d+1);e.output+=C.output,e.dirCount+=C.dirCount,e.fileCount+=C.fileCount}}else{e.fileCount++;let h=s.fullPath?m:r.name;e.output+=`${f+c+h}
|
|
9
|
+
`}}}catch{e.stderr=`tree: ${o}: Permission denied
|
|
10
|
+
`}return e}async function w(i,o,s,f,d){let e={output:"",stderr:"",dirCount:0,fileCount:0};if(s.maxDepth!==null&&d>=s.maxDepth)return e;try{let l=[];if(i.fs.readdirWithFileTypes)l=(await i.fs.readdirWithFileTypes(o)).map(t=>({name:t.name,isDirectory:t.isDirectory}));else{let n=await i.fs.readdir(o);for(let t=0;t<n.length;t+=100){let r=n.slice(t,t+100),m=await Promise.all(r.map(async u=>{let c=o==="/"?`/${u}`:`${o}/${u}`;try{let y=await i.fs.stat(c);return{name:u,isDirectory:y.isDirectory}}catch{return null}}));l.push(...m.filter(u=>u!==null))}}let a=l.filter(n=>!(!s.showHidden&&n.name.startsWith(".")||s.directoriesOnly&&!n.isDirectory));a.sort((n,t)=>n.name.localeCompare(t.name));for(let n=0;n<a.length;n++){let t=a[n],r=o==="/"?`/${t.name}`:`${o}/${t.name}`,m=n===a.length-1,u=m?"`-- ":"|-- ",c=f+(m?" ":"| ");if(t.isDirectory){e.dirCount++;let y=s.fullPath?r:t.name;e.output+=`${f+u+y}
|
|
11
|
+
`;let h=await w(i,r,s,c,d+1);e.output+=h.output,e.dirCount+=h.dirCount,e.fileCount+=h.fileCount}else{e.fileCount++;let y=s.fullPath?r:t.name;e.output+=`${f+u+y}
|
|
12
|
+
`}}}catch{}return e}var L={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0};export{O as a,L as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{c as u}from"./chunk-4PRVMER6.js";import{a as l,b as h}from"./chunk-GTNBSMZR.js";var d={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},y={name:"bash",async execute(t,e){if(h(t))return l(d);if(t[0]==="-c"&&t.length>=2){let r=t[1],s=t[2]||"bash",c=t.slice(3);return i(r,s,c,e)}if(t.length===0)return e.stdin?.trim()?i(e.stdin,"bash",[],e):{stdout:"",stderr:"",exitCode:0};let n=t[0],o=t.slice(1);try{let r=e.fs.resolvePath(e.cwd,n),s=await e.fs.readFile(r);return i(s,n,o,e)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
|
|
3
|
+
`,exitCode:127}}}},C={name:"sh",async execute(t,e){if(h(t))return l({...d,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(t[0]==="-c"&&t.length>=2){let r=t[1],s=t[2]||"sh",c=t.slice(3);return i(r,s,c,e)}if(t.length===0)return e.stdin?.trim()?i(e.stdin,"sh",[],e):{stdout:"",stderr:"",exitCode:0};let n=t[0],o=t.slice(1);try{let r=e.fs.resolvePath(e.cwd,n),s=await e.fs.readFile(r);return i(s,n,o,e)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
|
|
4
|
+
`,exitCode:127}}}};async function i(t,e,n,o){if(!o.exec)return{stdout:"",stderr:`bash: internal error: exec function not available
|
|
5
|
+
`,exitCode:1};let r=u(o.exportedEnv||{},{0:e,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((a,m)=>{r[String(m+1)]=a});let s=t;if(s.startsWith("#!")){let a=s.indexOf(`
|
|
6
|
+
`);a!==-1&&(s=s.slice(a+1))}return await o.exec(s,{env:r,cwd:o.cwd})}var b={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},P={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"};export{y as a,C as b,b as c,P as d};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as N}from"./chunk-JBABAK44.js";import{a as S,b as E}from"./chunk-GTNBSMZR.js";var b=class{diff(e,t,n={}){let s;typeof n=="function"?(s=n,n={}):"callback"in n&&(s=n.callback);let c=this.castInput(e,n),f=this.castInput(t,n),i=this.removeEmpty(this.tokenize(c,n)),a=this.removeEmpty(this.tokenize(f,n));return this.diffWithOptionsObj(i,a,n,s)}diffWithOptionsObj(e,t,n,s){var c;let f=r=>{if(r=this.postProcess(r,n),s){setTimeout(function(){s(r)},0);return}else return r},i=t.length,a=e.length,d=1,o=i+a;n.maxEditLength!=null&&(o=Math.min(o,n.maxEditLength));let g=(c=n.timeout)!==null&&c!==void 0?c:1/0,w=Date.now()+g,m=[{oldPos:-1,lastComponent:void 0}],P=this.extractCommon(m[0],t,e,0,n);if(m[0].oldPos+1>=a&&P+1>=i)return f(this.buildValues(m[0].lastComponent,t,e));let C=-1/0,x=1/0,y=()=>{for(let r=Math.max(C,-d);r<=Math.min(x,d);r+=2){let u,h=m[r-1],p=m[r+1];h&&(m[r-1]=void 0);let L=!1;if(p){let I=p.oldPos-r;L=p&&0<=I&&I<i}let v=h&&h.oldPos+1<a;if(!L&&!v){m[r]=void 0;continue}if(!v||L&&h.oldPos<p.oldPos?u=this.addToPath(p,!0,!1,0,n):u=this.addToPath(h,!1,!0,1,n),P=this.extractCommon(u,t,e,r,n),u.oldPos+1>=a&&P+1>=i)return f(this.buildValues(u.lastComponent,t,e))||!0;m[r]=u,u.oldPos+1>=a&&(x=Math.min(x,r-1)),P+1>=i&&(C=Math.max(C,r+1))}d++};if(s)(function r(){setTimeout(function(){if(d>o||Date.now()>w)return s(void 0);y()||r()},0)})();else for(;d<=o&&Date.now()<=w;){let r=y();if(r)return r}}addToPath(e,t,n,s,c){let f=e.lastComponent;return f&&!c.oneChangePerToken&&f.added===t&&f.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:f.count+1,added:t,removed:n,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:t,removed:n,previousComponent:f}}}extractCommon(e,t,n,s,c){let f=t.length,i=n.length,a=e.oldPos,d=a-s,o=0;for(;d+1<f&&a+1<i&&this.equals(n[a+1],t[d+1],c);)d++,a++,o++,c.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return o&&!c.oneChangePerToken&&(e.lastComponent={count:o,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,d}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let s=[],c;for(;e;)s.push(e),c=e.previousComponent,delete e.previousComponent,e=c;s.reverse();let f=s.length,i=0,a=0,d=0;for(;i<f;i++){let o=s[i];if(o.removed)o.value=this.join(n.slice(d,d+o.count)),d+=o.count;else{if(!o.added&&this.useLongestToken){let g=t.slice(a,a+o.count);g=g.map(function(w,m){let P=n[d+m];return P.length>w.length?P:w}),o.value=this.join(g)}else o.value=this.join(t.slice(a,a+o.count));a+=o.count,o.added||(d+=o.count)}}return s}};var T=class extends b{constructor(){super(...arguments),this.tokenize=W}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
3
|
+
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
4
|
+
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
5
|
+
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
6
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},O=new T;function D(l,e,t){return O.diff(l,e,t)}function W(l,e){e.stripTrailingCr&&(l=l.replace(/\r\n/g,`
|
|
7
|
+
`));let t=[],n=l.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let s=0;s<n.length;s++){let c=n[s];s%2&&!e.newlineIsToken?t[t.length-1]+=c:t.push(c)}return t}function F(l,e,t,n,s,c,f){let i;f?typeof f=="function"?i={callback:f}:i=f:i={},typeof i.context>"u"&&(i.context=4);let a=i.context;if(i.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(i.callback){let{callback:o}=i;D(t,n,Object.assign(Object.assign({},i),{callback:g=>{let w=d(g);o(w)}}))}else return d(D(t,n,i));function d(o){if(!o)return;o.push({value:"",lines:[]});function g(r){return r.map(function(u){return" "+u})}let w=[],m=0,P=0,C=[],x=1,y=1;for(let r=0;r<o.length;r++){let u=o[r],h=u.lines||A(u.value);if(u.lines=h,u.added||u.removed){if(!m){let p=o[r-1];m=x,P=y,p&&(C=a>0?g(p.lines.slice(-a)):[],m-=C.length,P-=C.length)}for(let p of h)C.push((u.added?"+":"-")+p);u.added?y+=h.length:x+=h.length}else{if(m)if(h.length<=a*2&&r<o.length-2)for(let p of g(h))C.push(p);else{let p=Math.min(h.length,a);for(let v of g(h.slice(0,p)))C.push(v);let L={oldStart:m,oldLines:x-m+p,newStart:P,newLines:y-P+p,lines:C};w.push(L),m=0,P=0,C=[]}x+=h.length,y+=h.length}}for(let r of w)for(let u=0;u<r.lines.length;u++)r.lines[u].endsWith(`
|
|
8
|
+
`)?r.lines[u]=r.lines[u].slice(0,-1):(r.lines.splice(u+1,0,"\"),u++);return{oldFileName:l,newFileName:e,oldHeader:s,newHeader:c,hunks:w}}}function k(l){if(Array.isArray(l))return l.map(k).join(`
|
|
9
|
+
`);let e=[];l.oldFileName==l.newFileName&&e.push("Index: "+l.oldFileName),e.push("==================================================================="),e.push("--- "+l.oldFileName+(typeof l.oldHeader>"u"?"":" "+l.oldHeader)),e.push("+++ "+l.newFileName+(typeof l.newHeader>"u"?"":" "+l.newHeader));for(let t=0;t<l.hunks.length;t++){let n=l.hunks[t];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),e.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@");for(let s of n.lines)e.push(s)}return e.join(`
|
|
10
|
+
`)+`
|
|
11
|
+
`}function j(l,e,t,n,s,c,f){if(typeof f=="function"&&(f={callback:f}),f?.callback){let{callback:i}=f;F(l,e,t,n,s,c,Object.assign(Object.assign({},f),{callback:a=>{i(a?k(a):void 0)}}))}else{let i=F(l,e,t,n,s,c,f);return i?k(i):void 0}}function A(l){let e=l.endsWith(`
|
|
12
|
+
`),t=l.split(`
|
|
13
|
+
`).map(n=>n+`
|
|
14
|
+
`);return e?t.pop():t.push(t.pop().slice(0,-1)),t}var M={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},q={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},K={name:"diff",async execute(l,e){if(E(l))return S(M);let t=N("diff",l,q);if(!t.ok)return t.error;let n=t.result.flags.brief,s=t.result.flags.reportSame,c=t.result.flags.ignoreCase,f=t.result.positional;if(t.result.flags.unified,f.length<2)return{stdout:"",stderr:`diff: missing operand
|
|
15
|
+
`,exitCode:2};let i,a,[d,o]=f;try{i=d==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,d))}catch{return{stdout:"",stderr:`diff: ${d}: No such file or directory
|
|
16
|
+
`,exitCode:2}}try{a=o==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,o))}catch{return{stdout:"",stderr:`diff: ${o}: No such file or directory
|
|
17
|
+
`,exitCode:2}}let g=i,w=a;return c&&(g=g.toLowerCase(),w=w.toLowerCase()),g===w?s?{stdout:`Files ${d} and ${o} are identical
|
|
18
|
+
`,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:n?{stdout:`Files ${d} and ${o} differ
|
|
19
|
+
`,stderr:"",exitCode:1}:{stdout:j(d,o,i,a,"","",{context:3}),stderr:"",exitCode:1}}},Q={name:"diff",flags:[{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-i",type:"boolean"}],needsArgs:!0,minArgs:2};export{K as a,Q as b};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as f,b as c,c as a}from"./chunk-GTNBSMZR.js";var x={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
|
|
3
|
+
|
|
4
|
+
DURATION is a number with optional suffix:
|
|
5
|
+
s - seconds (default)
|
|
6
|
+
m - minutes
|
|
7
|
+
h - hours
|
|
8
|
+
d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]};function A(r){let i=r.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!i)return null;let n=parseFloat(i[1]);switch(i[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var v={name:"timeout",async execute(r,i){if(c(r))return f(x);let n=!1,s=0;for(let e=0;e<r.length;e++){let t=r[e];if(t==="--preserve-status")n=!0,s=e+1;else if(t==="--foreground")s=e+1;else if(t==="-k"||t==="--kill-after")e++,s=e+1;else if(t.startsWith("--kill-after="))s=e+1;else if(t==="-s"||t==="--signal")e++,s=e+1;else if(t.startsWith("--signal="))s=e+1;else{if(t.startsWith("--")&&t!=="--")return a("timeout",t);if(t.startsWith("-")&&t.length>1&&t!=="--")if(t.startsWith("-k"))s=e+1;else if(t.startsWith("-s"))s=e+1;else return a("timeout",t);else{s=e;break}}}let o=r.slice(s);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
9
|
+
`,exitCode:1};let u=o[0],l=A(u);if(l===null)return{stdout:"",stderr:`timeout: invalid time interval '${u}'
|
|
10
|
+
`,exitCode:1};let m=o.slice(1);if(m.length===0)return{stdout:"",stderr:`timeout: missing operand
|
|
11
|
+
`,exitCode:1};if(!i.exec)return{stdout:"",stderr:`timeout: exec not available
|
|
12
|
+
`,exitCode:1};let g=m.map(e=>e.includes(" ")||e.includes(" ")?`'${e.replace(/'/g,"'\\''")}'`:e).join(" "),p=new Promise(e=>{setTimeout(()=>e({timedOut:!0}),l)}),h=i.exec(g,{cwd:i.cwd}).then(e=>({timedOut:!1,result:e})),d=await Promise.race([p,h]);return d.timedOut?{stdout:"",stderr:"",exitCode:124}:d.result}},k={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2};export{v as a,k as b};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as b,b as $}from"./chunk-GTNBSMZR.js";import
|
|
2
|
+
import{a as b,b as $}from"./chunk-GTNBSMZR.js";import{existsSync as h}from"node:fs";import{dirname as B,join as p}from"node:path";import{fileURLToPath as U}from"node:url";import{Worker as D}from"node:worker_threads";import H from"sql.js";function q(e,r,n){switch(n.mode){case"list":return y(e,r,n);case"csv":return L(e,r,n);case"json":return V(e,r);case"line":return O(e,r,n);case"column":return A(e,r,n);case"table":return N(e,r,n);case"markdown":return P(e,r,n);case"tabs":return I(e,r,n);case"box":return M(e,r,n);case"quote":return R(e,r,n);case"html":return F(e,r,n);case"ascii":return Q(e,r,n)}}function u(e,r){return e==null?r:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString("utf8"):typeof e=="number"&&!Number.isInteger(e)?e.toPrecision(17).replace(/\.?0+$/,""):String(e)}function y(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.join(n.separator));for(let l of r)t.push(l.map(i=>u(i,n.nullValue)).join(n.separator));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function L(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.map(j).join(","));for(let l of r)t.push(l.map(i=>j(u(i,n.nullValue))).join(","));return t.length>0?`${t.join(`
|
|
3
3
|
`)}
|
|
4
4
|
`:""}function j(e){return e.includes(",")||e.includes('"')||e.includes("'")||e.includes(`
|
|
5
5
|
`)?`"${e.replace(/"/g,'""')}"`:e}function E(e){return e.toPrecision(17).replace(/\.?0+$/,"")}function k(e){return e===null?"null":typeof e=="number"?Number.isInteger(e)?String(e):E(e):JSON.stringify(e)}function V(e,r){return r.length===0?"":`[${r.map(t=>`{${e.map((i,s)=>`${JSON.stringify(i)}:${k(t[s])}`).join(",")}}`).join(`,
|
|
6
6
|
`)}]
|
|
7
7
|
`}function O(e,r,n){if(e.length===0||r.length===0)return"";let t=Math.max(5,...e.map(i=>i.length)),l=[];for(let i of r)for(let s=0;s<e.length;s++){let o=e[s].padStart(t);l.push(`${o} = ${u(i[s],n.nullValue)}`)}return`${l.join(`
|
|
8
8
|
`)}
|
|
9
|
-
`}function
|
|
9
|
+
`}function A(e,r,n){if(e.length===0)return"";let t=e.map(i=>i.length);for(let i of r)for(let s=0;s<i.length;s++){let o=u(i[s],n.nullValue).length;o>t[s]&&(t[s]=o)}let l=[];n.header&&(l.push(e.map((i,s)=>i.padEnd(t[s])).join(" ")),l.push(t.map(i=>"-".repeat(i)).join(" ")));for(let i of r)l.push(i.map((s,o)=>u(s,n.nullValue).padEnd(t[o])).join(" "));return l.length>0?`${l.join(`
|
|
10
10
|
`)}
|
|
11
|
-
`:""}function
|
|
11
|
+
`:""}function N(e,r,n){if(e.length===0)return"";let t=e.map(s=>s.length);for(let s of r)for(let o=0;o<s.length;o++){let f=u(s[o],n.nullValue).length;f>t[o]&&(t[o]=f)}let l=[],i=`+${t.map(s=>"-".repeat(s+2)).join("+")}+`;l.push(i),n.header&&(l.push(`| ${e.map((s,o)=>s.padEnd(t[o])).join(" | ")} |`),l.push(i));for(let s of r)l.push(`| ${s.map((o,f)=>u(o,n.nullValue).padEnd(t[f])).join(" | ")} |`);return l.push(i),`${l.join(`
|
|
12
12
|
`)}
|
|
13
|
-
`}function
|
|
13
|
+
`}function P(e,r,n){if(e.length===0)return"";let t=[];n.header&&(t.push(`| ${e.join(" | ")} |`),t.push(`|${e.map(()=>"---").join("|")}|`));for(let l of r)t.push(`| ${l.map(i=>u(i,n.nullValue)).join(" | ")} |`);return t.length>0?`${t.join(`
|
|
14
14
|
`)}
|
|
15
15
|
`:""}function I(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.join(" "));for(let l of r)t.push(l.map(i=>u(i,n.nullValue)).join(" "));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function M(e,r,n){if(e.length===0)return"";let t=e.map(i=>i.length);for(let i of r)for(let s=0;s<i.length;s++){let o=u(i[s],n.nullValue).length;o>t[s]&&(t[s]=o)}let l=[];l.push(`\u250C${t.map(i=>"\u2500".repeat(i+2)).join("\u252C")}\u2510`),l.push(`\u2502 ${e.map((i,s)=>i.padEnd(t[s])).join(" \u2502 ")} \u2502`),l.push(`\u251C${t.map(i=>"\u2500".repeat(i+2)).join("\u253C")}\u2524`);for(let i of r)l.push(`\u2502 ${i.map((s,o)=>u(s,n.nullValue).padEnd(t[o])).join(" \u2502 ")} \u2502`);return l.push(`\u2514${t.map(i=>"\u2500".repeat(i+2)).join("\u2534")}\u2518`),`${l.join(`
|
|
16
16
|
`)}
|
|
17
|
-
`}function R(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.map(l=>`'${l}'`).join(","));for(let l of r)t.push(l.map(i=>i==null?"NULL":typeof i=="number"?Number.isInteger(i)?String(i):E(i):`'${String(i)}'`).join(","));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function
|
|
17
|
+
`}function R(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.map(l=>`'${l}'`).join(","));for(let l of r)t.push(l.map(i=>i==null?"NULL":typeof i=="number"?Number.isInteger(i)?String(i):E(i):`'${String(i)}'`).join(","));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function F(e,r,n){let t=[];n.header&&e.length>0&&(t.push(`<TR>${e.map(l=>`<TH>${S(l)}</TH>`).join("")}`),t.push("</TR>"));for(let l of r)t.push(`<TR>${l.map(i=>`<TD>${S(u(i,n.nullValue))}</TD>`).join("")}`),t.push("</TR>");return t.length>0?`${t.join(`
|
|
18
18
|
`)}
|
|
19
|
-
`:""}function S(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function
|
|
19
|
+
`:""}function S(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Q(e,r,n){let i=[];n.header&&e.length>0&&i.push(e.join(""));for(let s of r)i.push(s.map(o=>u(o,n.nullValue)).join(""));return i.length>0?i.join("")+"":""}var J=5e3,W={name:"sqlite3",summary:"SQLite database CLI",usage:"sqlite3 [OPTIONS] DATABASE [SQL]",options:["-list output in list mode (default)","-csv output in CSV mode","-json output in JSON mode","-line output in line mode","-column output in column mode","-table output as ASCII table","-markdown output as markdown table","-tabs output in tab-separated mode","-box output in Unicode box mode","-quote output in SQL quote mode","-html output as HTML table","-ascii output in ASCII mode (control chars)","-header show column headers","-noheader hide column headers","-separator SEP field separator for list mode (default: |)","-newline SEP row separator (default: \\n)","-nullvalue TEXT text for NULL values (default: empty)","-readonly open database read-only (no writeback)","-bail stop on first error","-echo print SQL before execution","-cmd COMMAND run SQL command before main SQL","-version show SQLite version","-- end of options","--help show this help"],examples:['sqlite3 :memory: "CREATE TABLE t(x); INSERT INTO t VALUES(1); SELECT * FROM t"','sqlite3 -json data.db "SELECT * FROM users"','sqlite3 -csv -header data.db "SELECT id, name FROM products"','sqlite3 -box data.db "SELECT * FROM users"']};function _(e){let r={mode:"list",header:!1,separator:"|",newline:`
|
|
20
20
|
`,nullValue:"",readonly:!1,bail:!1,echo:!1,cmd:null},n=null,t=null,l=!1,i=!1;for(let s=0;s<e.length;s++){let o=e[s];if(i){n===null?n=o:t===null&&(t=o);continue}if(o==="--")i=!0;else if(o==="-version")l=!0;else if(o==="-list")r.mode="list";else if(o==="-csv")r.mode="csv";else if(o==="-json")r.mode="json";else if(o==="-line")r.mode="line";else if(o==="-column")r.mode="column";else if(o==="-table")r.mode="table";else if(o==="-markdown")r.mode="markdown";else if(o==="-tabs")r.mode="tabs";else if(o==="-box")r.mode="box";else if(o==="-quote")r.mode="quote";else if(o==="-html")r.mode="html";else if(o==="-ascii")r.mode="ascii";else if(o==="-header")r.header=!0;else if(o==="-noheader")r.header=!1;else if(o==="-readonly")r.readonly=!0;else if(o==="-bail")r.bail=!0;else if(o==="-echo")r.echo=!0;else if(o==="-separator"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -separator
|
|
21
21
|
`,exitCode:1};r.separator=e[++s]}else if(o==="-newline"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -newline
|
|
22
22
|
`,exitCode:1};r.newline=e[++s]}else if(o==="-nullvalue"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -nullvalue
|
|
23
23
|
`,exitCode:1};r.nullValue=e[++s]}else if(o==="-cmd"){if(s+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -cmd
|
|
24
24
|
`,exitCode:1};r.cmd=e[++s]}else{if(o.startsWith("-"))return{stdout:"",stderr:`sqlite3: Error: unknown option: ${o.startsWith("--")?o.slice(1):o}
|
|
25
25
|
Use -help for a list of options.
|
|
26
|
-
`,exitCode:1};n===null?n=o:t===null&&(t=o)}}return{options:r,database:n,sql:t,showVersion:l}}async function
|
|
26
|
+
`,exitCode:1};n===null?n=o:t===null&&(t=o)}}return{options:r,database:n,sql:t,showVersion:l}}async function z(){let e=await H(),r=new e.Database;try{let n=r.exec("SELECT sqlite_version()");return n.length>0&&n[0].values.length>0?String(n[0].values[0][0]):"unknown"}finally{r.close()}}function X(){let e=B(U(import.meta.url)),r=p(e,"../../commands/sqlite3/worker.js");if(h(r))return r;let n=p(e,"worker.js");if(h(n))return n;let t=p(e,"../../../dist/commands/sqlite3/worker.js");if(h(t))return t;throw new Error("sqlite3 worker not found. Run 'pnpm build' to compile the worker.")}async function Y(e,r){try{let n=X();return await new Promise((t,l)=>{let i=new D(n,{workerData:e}),s=setTimeout(()=>{i.terminate(),t({success:!1,error:`Query timeout: execution exceeded ${r}ms limit`})},r);i.on("message",o=>{clearTimeout(s),t(o)}),i.on("error",o=>{clearTimeout(s),l(o)}),i.on("exit",o=>{clearTimeout(s),o!==0&&t({success:!1,error:`Worker exited with code ${o}`})})})}catch(n){throw new Error(`sqlite3 worker failed to load: ${n.message}`)}}var oe={name:"sqlite3",async execute(e,r){if($(e)||e.includes("-help"))return b(W);let n=_(e);if("exitCode"in n)return n;let{options:t,database:l,sql:i,showVersion:s}=n;if(s)return{stdout:`${await z()}
|
|
27
27
|
`,stderr:"",exitCode:0};if(!l)return{stdout:"",stderr:`sqlite3: missing database argument
|
|
28
28
|
`,exitCode:1};let o=i||r.stdin.trim();if(t.cmd&&(o=t.cmd+(o?`; ${o}`:"")),!o)return{stdout:"",stderr:`sqlite3: no SQL provided
|
|
29
29
|
`,exitCode:1};let f=l===":memory:",m="",g=null;try{f||(m=r.fs.resolvePath(r.cwd,l),await r.fs.exists(m)&&(g=await r.fs.readFileBuffer(m)))}catch(a){return{stdout:"",stderr:`sqlite3: unable to open database "${l}": ${a.message}
|
|
30
|
-
`,exitCode:1}}let
|
|
30
|
+
`,exitCode:1}}let x=r.limits?.maxSqliteTimeoutMs??J,T={dbBuffer:g,sql:o,options:{bail:t.bail,echo:t.echo}},d;try{d=await Y(T,x)}catch(a){return{stdout:"",stderr:`sqlite3: worker error: ${a.message}
|
|
31
31
|
`,exitCode:1}}if(!d.success)return{stdout:"",stderr:`sqlite3: ${d.error}
|
|
32
32
|
`,exitCode:1};let C={mode:t.mode,header:t.header,separator:t.separator,newline:t.newline,nullValue:t.nullValue},c="";t.echo&&(c+=`${o}
|
|
33
33
|
`);let w=!1;for(let a of d.results)if(a.type==="error"){if(t.bail)return{stdout:c,stderr:`Error: ${a.error}
|
|
34
34
|
`,exitCode:1};c+=`Error: ${a.error}
|
|
35
35
|
`,w=!0}else a.columns&&a.rows&&(a.rows.length>0||t.header)&&(c+=q(a.columns,a.rows,C));if(d.hasModifications&&!t.readonly&&!f&&m&&d.dbBuffer)try{await r.fs.writeFile(m,d.dbBuffer)}catch(a){return{stdout:c,stderr:`sqlite3: failed to write database: ${a.message}
|
|
36
|
-
`,exitCode:1}}return{stdout:c,stderr:"",exitCode:w&&t.bail?1:0}}};export{oe as
|
|
36
|
+
`,exitCode:1}}return{stdout:c,stderr:"",exitCode:w&&t.bail?1:0}}},ie={name:"sqlite3",flags:[],needsArgs:!0};export{oe as a,ie as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as o,b as i}from"./chunk-GTNBSMZR.js";var m={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},p={name:"dirname",async execute(t,l){if(i(t))return o(m);let r=t.filter(n=>!n.startsWith("-"));if(r.length===0)return{stdout:"",stderr:`dirname: missing operand
|
|
3
|
+
`,exitCode:1};let e=[];for(let n of r){let a=n.replace(/\/+$/,""),s=a.lastIndexOf("/");s===-1?e.push("."):s===0?e.push("/"):e.push(a.slice(0,s))}return{stdout:`${e.join(`
|
|
4
|
+
`)}
|
|
5
|
+
`,stderr:"",exitCode:0}}},c={name:"dirname",flags:[],needsArgs:!0};export{p as a,c as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as r,b as m}from"./chunk-GTNBSMZR.js";var p={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX]
|
|
3
|
+
basename OPTION... NAME...`,options:["-a, --multiple support multiple arguments","-s, --suffix=SUFFIX remove a trailing SUFFIX"," --help display this help and exit"]},c={name:"basename",async execute(n,u){if(m(n))return r(p);let l=!1,s="",a=[];for(let t=0;t<n.length;t++){let e=n[t];e==="-a"||e==="--multiple"?l=!0:e==="-s"&&t+1<n.length?(s=n[++t],l=!0):e.startsWith("--suffix=")?(s=e.slice(9),l=!0):e.startsWith("-")||a.push(e)}if(a.length===0)return{stdout:"",stderr:`basename: missing operand
|
|
4
|
+
`,exitCode:1};!l&&a.length>=2&&(s=a.pop()??"");let o=[];for(let t of a){let e=t.replace(/\/+$/,""),i=e.split("/").pop()||e;s&&i.endsWith(s)&&(i=i.slice(0,-s.length)),o.push(i)}return{stdout:`${o.join(`
|
|
5
|
+
`)}
|
|
6
|
+
`,stderr:"",exitCode:0}}},h={name:"basename",flags:[{flag:"-a",type:"boolean"},{flag:"-s",type:"value",valueHint:"string"}],needsArgs:!0};export{c as a,h as b};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as m}from"./chunk-JBABAK44.js";import{a as $}from"./chunk-4VDEBYW7.js";import{a as y,b as h}from"./chunk-GTNBSMZR.js";var D={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},E={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},A={name:"cp",async execute(f,e){if(h(f))return y(D);let t=m("cp",f,E);if(!t.ok)return t.error;let u=t.result.flags.recursive||t.result.flags.recursiveUpper,w=t.result.flags.noClobber,C=t.result.flags.preserve,P=t.result.flags.verbose,c=t.result.positional;if(c.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
3
|
+
`,exitCode:1};let g=c.pop()??"",d=c,o=e.fs.resolvePath(e.cwd,g),b="",n="",l=0,p=!1;try{p=(await e.fs.stat(o)).isDirectory}catch{}if(d.length>1&&!p)return{stdout:"",stderr:`cp: target '${g}' is not a directory
|
|
4
|
+
`,exitCode:1};for(let r of d)try{let a=e.fs.resolvePath(e.cwd,r),s=await e.fs.stat(a),i=o;if(p){let v=r.split("/").pop()||r;i=o==="/"?`/${v}`:`${o}/${v}`}if(s.isDirectory&&!u){n+=`cp: -r not specified; omitting directory '${r}'
|
|
5
|
+
`,l=1;continue}if(w)try{await e.fs.stat(i);continue}catch{}await e.fs.cp(a,i,{recursive:u}),P&&(b+=`'${r}' -> '${i}'
|
|
6
|
+
`)}catch(a){let s=$(a);s.includes("ENOENT")||s.includes("no such file")?n+=`cp: cannot stat '${r}': No such file or directory
|
|
7
|
+
`:n+=`cp: cannot copy '${r}': ${s}
|
|
8
|
+
`,l=1}return{stdout:b,stderr:n,exitCode:l}}},F={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{A as a,F as b};
|