@poe-platform/safe-bash 0.1.800 → 0.1.802

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/README.md +16 -5
  2. package/dist/image-ast/index.browser.js +122 -76
  3. package/dist/image-ast/index.js +122 -76
  4. package/dist/pdf-ast/index.js +4 -3
  5. package/dist/safe-bash/chunks/chunk-3HQU4OJO.js +13 -0
  6. package/dist/safe-bash/chunks/{chunk-LUOFIVNI.js → chunk-3NDIFSNM.js} +3 -3
  7. package/dist/safe-bash/chunks/{chunk-4SEW2Q6H.js → chunk-3R3AANOR.js} +1 -1
  8. package/dist/safe-bash/chunks/{chunk-K4YMYFRJ.js → chunk-44ALJ4QG.js} +5809 -7424
  9. package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
  10. package/dist/safe-bash/chunks/chunk-4BSJLKNM.js +14 -0
  11. package/dist/safe-bash/chunks/chunk-4D4N7IU2.js +47 -0
  12. package/dist/safe-bash/chunks/chunk-55YJASTN.js +14 -0
  13. package/dist/safe-bash/chunks/{chunk-XB3B7KMM.js → chunk-6O77NL2S.js} +1 -1
  14. package/dist/safe-bash/chunks/{chunk-T3JTVIEP.js → chunk-6PAVEFT3.js} +1 -1
  15. package/dist/safe-bash/chunks/{chunk-PYVEAFJM.js → chunk-74GHTNJA.js} +3 -2
  16. package/dist/safe-bash/chunks/{chunk-LQHGH25W.js → chunk-7R5BDCG7.js} +1 -1
  17. package/dist/safe-bash/chunks/chunk-7ZBU7KYV.js +14 -0
  18. package/dist/safe-bash/chunks/{chunk-MHZ24KEI.js → chunk-AM5ESLPH.js} +1 -1
  19. package/dist/safe-bash/chunks/{chunk-3L3T6LYV.js → chunk-AUSNDQTJ.js} +1 -1
  20. package/dist/safe-bash/chunks/{chunk-YG5WAHK7.js → chunk-B7TAL7S5.js} +1 -3
  21. package/dist/safe-bash/chunks/{chunk-QVSRRNZT.js → chunk-BJA5XNP6.js} +6 -6
  22. package/dist/safe-bash/chunks/{chunk-K7IQZE7D.js → chunk-C5OWC2TL.js} +1 -1
  23. package/dist/safe-bash/chunks/{chunk-F3RV2F72.js → chunk-CHYGPFVM.js} +1 -1
  24. package/dist/safe-bash/chunks/{chunk-M4CFCXHN.js → chunk-CS4MNM6I.js} +1 -1
  25. package/dist/safe-bash/chunks/{chunk-H6JW3E4F.js → chunk-CTVWDACF.js} +1 -1
  26. package/dist/safe-bash/chunks/{chunk-BHJE5LPZ.js → chunk-D3ANYGMC.js} +1 -1
  27. package/dist/safe-bash/chunks/chunk-DQP3VHSB.js +15 -0
  28. package/dist/safe-bash/chunks/{chunk-NLAW7KDI.js → chunk-E7OYNDGL.js} +1 -1
  29. package/dist/safe-bash/chunks/{chunk-SOZK5JVX.js → chunk-FBUCWVTE.js} +1 -1
  30. package/dist/safe-bash/chunks/chunk-FZE4HW6G.js +11 -0
  31. package/dist/safe-bash/chunks/chunk-GEG3BWGE.js +14 -0
  32. package/dist/safe-bash/chunks/{chunk-HHW7MGS2.js → chunk-GETUOD5D.js} +4 -4
  33. package/dist/safe-bash/chunks/chunk-HBCN24ZA.js +50 -0
  34. package/dist/safe-bash/chunks/chunk-HZ7BWKQ3.js +13 -0
  35. package/dist/safe-bash/chunks/{chunk-JJSTTIEZ.js → chunk-HZAMGT5I.js} +3 -3
  36. package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -1
  37. package/dist/safe-bash/chunks/{chunk-KV7PKOHV.js → chunk-IWDICZVK.js} +1 -1
  38. package/dist/safe-bash/chunks/{chunk-I4OAEOP6.js → chunk-J42RIHHJ.js} +1 -1
  39. package/dist/safe-bash/chunks/{chunk-K2VCOJ2B.js → chunk-K6VCD7IY.js} +7 -12
  40. package/dist/safe-bash/chunks/chunk-KDNSPLII.js +83 -0
  41. package/dist/safe-bash/chunks/{chunk-63FXVDGF.js → chunk-LVOBFF4D.js} +1 -1
  42. package/dist/safe-bash/chunks/{chunk-U5NUZPCC.js → chunk-MHMMRCYC.js} +1 -1
  43. package/dist/safe-bash/chunks/{chunk-KW24TAIU.js → chunk-NQCM3TYR.js} +922 -658
  44. package/dist/safe-bash/chunks/{chunk-VYZTG3GV.js → chunk-NZQXYWA3.js} +1 -1
  45. package/dist/safe-bash/chunks/{chunk-TFGRKY43.js → chunk-OQRVVGR6.js} +1 -1
  46. package/dist/safe-bash/chunks/{chunk-PPYM75Z3.js → chunk-OV6IHKO6.js} +2 -2
  47. package/dist/safe-bash/chunks/{chunk-TYD7EVUJ.js → chunk-PH63PLPZ.js} +8 -8
  48. package/dist/safe-bash/chunks/chunk-QGUV42T5.js +44 -0
  49. package/dist/safe-bash/chunks/chunk-R3NAKOED.js +51 -0
  50. package/dist/safe-bash/chunks/chunk-RRR7AQ24.js +38 -0
  51. package/dist/safe-bash/chunks/{chunk-RKKRJ54E.js → chunk-RSTHLAF3.js} +30 -23
  52. package/dist/safe-bash/chunks/{chunk-RMWLWH7Q.js → chunk-SHEMU2Z7.js} +378 -1148
  53. package/dist/safe-bash/chunks/{chunk-7YSRXFEG.js → chunk-TFIBK2GI.js} +1 -1
  54. package/dist/safe-bash/chunks/{chunk-I7L3G3NX.js → chunk-UE5KZDEK.js} +2 -2
  55. package/dist/safe-bash/chunks/{chunk-QU3BVQ53.js → chunk-UTBUUFDM.js} +1 -1
  56. package/dist/safe-bash/chunks/{chunk-6HZYFL3H.js → chunk-VKNVHEX3.js} +2 -7
  57. package/dist/safe-bash/chunks/chunk-VSAJ4OTM.js +962 -0
  58. package/dist/safe-bash/chunks/{chunk-46UISJCK.js → chunk-VTH3MLDU.js} +1 -1
  59. package/dist/safe-bash/chunks/{chunk-JTLSUJ7V.js → chunk-WDLGKIHD.js} +56 -39
  60. package/dist/safe-bash/chunks/chunk-XAQMU6OY.js +14 -0
  61. package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
  62. package/dist/safe-bash/chunks/chunk-ZVD5IS4V.js +49 -0
  63. package/dist/safe-bash/chunks/{csvkit-QGP3GAOB.js → csvkit-TACDU7FC.js} +3 -3
  64. package/dist/safe-bash/chunks/{ffmpeg-JTVH26MK.js → ffmpeg-WTC3TEFI.js} +2 -2
  65. package/dist/safe-bash/chunks/{gh-I7QX7N5C.js → gh-6WU6PXL4.js} +2 -2
  66. package/dist/safe-bash/chunks/{git-MA7NKYVP.js → git-EFZIGJW4.js} +2 -2
  67. package/dist/safe-bash/chunks/{imagemagick-Y4NPWX2Q.js → imagemagick-EIEYGWPF.js} +2 -2
  68. package/dist/safe-bash/chunks/{implementation-BWDKOVQJ.js → implementation-MLFHUQ5M.js} +2 -2
  69. package/dist/safe-bash/chunks/{mmdc-44PELHDG.js → mmdc-ROQJT5HQ.js} +2 -2
  70. package/dist/safe-bash/chunks/{pdfimages-635TRW4Q.js → pdfimages-DW7LWXFI.js} +2 -2
  71. package/dist/safe-bash/chunks/{pdfinfo-FSDAA2KY.js → pdfinfo-TIP6XLUQ.js} +2 -2
  72. package/dist/safe-bash/chunks/{pdftk-GQ5UH3VG.js → pdftk-DMG22ITZ.js} +2 -2
  73. package/dist/safe-bash/chunks/{pdftoppm-YTXQCAYT.js → pdftoppm-WNDYR72T.js} +2 -2
  74. package/dist/safe-bash/chunks/{pdftotext-CVA2G7FY.js → pdftotext-5IPZ4NI7.js} +2 -2
  75. package/dist/safe-bash/chunks/{qpdf-HZMIFG4A.js → qpdf-TTX2DIUA.js} +2 -2
  76. package/dist/safe-bash/chunks/{sips-E7UBDP33.js → sips-XYS46JPJ.js} +2 -2
  77. package/dist/safe-bash/chunks/{soffice-ELASUWUK.js → soffice-TU73E5KL.js} +2 -2
  78. package/dist/safe-bash/chunks/{wkhtmltopdf-EPO6YCMG.js → wkhtmltopdf-FSZ2CHGE.js} +2 -2
  79. package/dist/safe-bash/command-chunks/{chunk-QBGA56UH.js → chunk-2ELYGJDD.js} +7 -7
  80. package/dist/safe-bash/command-chunks/{chunk-52PCQXD2.js → chunk-2NHI5F5S.js} +2 -1
  81. package/dist/safe-bash/command-chunks/{chunk-HDKVO47G.js → chunk-2SQEIUGJ.js} +3 -3
  82. package/dist/safe-bash/command-chunks/{chunk-5LSGEIZY.js → chunk-3HHCU5YU.js} +4 -3
  83. package/dist/safe-bash/command-chunks/{chunk-TF6OA2GK.js → chunk-3NV3HYT2.js} +1 -1
  84. package/dist/safe-bash/command-chunks/{chunk-2QHG43WJ.js → chunk-4BB2SWJ5.js} +1 -1
  85. package/dist/safe-bash/command-chunks/{chunk-IEXHHNOF.js → chunk-4J5CZ2DP.js} +2 -7
  86. package/dist/safe-bash/command-chunks/{chunk-WDHI3S6Y.js → chunk-4OOUQTQO.js} +1 -1
  87. package/dist/safe-bash/command-chunks/{chunk-YMONDXET.js → chunk-4ZQWGOZB.js} +2 -2
  88. package/dist/safe-bash/command-chunks/{chunk-L6DVEBW3.js → chunk-5BSTFCXG.js} +2 -2
  89. package/dist/safe-bash/command-chunks/{chunk-Q3DII3Q7.js → chunk-5PWJG2UK.js} +1 -1
  90. package/dist/safe-bash/command-chunks/{chunk-JMPP4TCW.js → chunk-5UBXNSFZ.js} +3 -2
  91. package/dist/safe-bash/command-chunks/{chunk-3NG75MOB.js → chunk-67GQA75T.js} +1 -1
  92. package/dist/safe-bash/command-chunks/{chunk-L6SU4S26.js → chunk-6B7WQIKB.js} +0 -7
  93. package/dist/safe-bash/command-chunks/{chunk-V6MSPQLA.js → chunk-6BNTBWIK.js} +4 -39
  94. package/dist/safe-bash/command-chunks/{chunk-SAMH7SQE.js → chunk-6GWJUQAV.js} +237 -145
  95. package/dist/safe-bash/command-chunks/{chunk-JN7WIP6S.js → chunk-6KJ3LPI2.js} +2 -2
  96. package/dist/safe-bash/command-chunks/{chunk-HLDTOR7M.js → chunk-6ZVI7LUY.js} +1 -1
  97. package/dist/safe-bash/command-chunks/{chunk-X6NJC3IC.js → chunk-75OFBY5R.js} +1 -1
  98. package/dist/safe-bash/command-chunks/{chunk-MRW5HD2D.js → chunk-7O3E4LPT.js} +4 -22
  99. package/dist/safe-bash/command-chunks/{chunk-TEVJJPTC.js → chunk-7U7EXOXX.js} +1 -1
  100. package/dist/safe-bash/command-chunks/{chunk-6CYTRQ24.js → chunk-7VTKQUA5.js} +20 -17
  101. package/dist/safe-bash/command-chunks/{chunk-BZPAWTUL.js → chunk-AEF5BA3D.js} +1 -1
  102. package/dist/safe-bash/command-chunks/{chunk-63R3FEZJ.js → chunk-AIV5BF5W.js} +1 -1
  103. package/dist/safe-bash/command-chunks/{chunk-AYUTO323.js → chunk-AKJG2XD3.js} +2 -18
  104. package/dist/safe-bash/command-chunks/{chunk-J34TZVMW.js → chunk-ALDC4XP4.js} +0 -5
  105. package/dist/safe-bash/command-chunks/{chunk-CKXV2CLD.js → chunk-ARBYOQUZ.js} +1 -1
  106. package/dist/safe-bash/command-chunks/{chunk-44AHAB5O.js → chunk-BDSMROQZ.js} +1 -4
  107. package/dist/safe-bash/command-chunks/{chunk-53P53XFM.js → chunk-BPE5INLI.js} +1 -1
  108. package/dist/safe-bash/command-chunks/{chunk-OT4LZMLB.js → chunk-BR73BIOW.js} +1 -1
  109. package/dist/safe-bash/command-chunks/{chunk-WB5SVIG7.js → chunk-C5YYCQHW.js} +498 -88
  110. package/dist/safe-bash/command-chunks/{chunk-EUSPTFAX.js → chunk-CAP7ZJSY.js} +7 -7
  111. package/dist/safe-bash/command-chunks/{chunk-DWFLVJC6.js → chunk-CCRHMAU5.js} +2 -1
  112. package/dist/safe-bash/command-chunks/{chunk-GI4CJED2.js → chunk-CQTRW45K.js} +1 -1
  113. package/dist/safe-bash/command-chunks/{chunk-KKG4BAFZ.js → chunk-DIEPXUM4.js} +6 -0
  114. package/dist/safe-bash/command-chunks/{chunk-QJAFJP2G.js → chunk-DZCY63VJ.js} +12 -10
  115. package/dist/safe-bash/command-chunks/{chunk-QUENU6GM.js → chunk-E55UKBIE.js} +3 -3
  116. package/dist/safe-bash/command-chunks/{chunk-MC3VWLIZ.js → chunk-FDBUV4HJ.js} +28 -19
  117. package/dist/safe-bash/command-chunks/{chunk-7FKUC34S.js → chunk-FPVUD6TH.js} +6 -3
  118. package/dist/safe-bash/command-chunks/{chunk-E2LB7FRT.js → chunk-FXOA7RBK.js} +1 -1
  119. package/dist/safe-bash/command-chunks/{chunk-QWIDNAAK.js → chunk-FZTK4MFI.js} +3 -3
  120. package/dist/safe-bash/command-chunks/{chunk-K543PB3I.js → chunk-G66QUHIZ.js} +6 -35
  121. package/dist/safe-bash/command-chunks/{chunk-YJDV76GL.js → chunk-GFQZCKO6.js} +29 -19
  122. package/dist/safe-bash/command-chunks/{chunk-FKKB5X5V.js → chunk-GOB777HR.js} +1 -1
  123. package/dist/safe-bash/command-chunks/{chunk-IYPAQ7PH.js → chunk-GRBWW4SG.js} +6 -0
  124. package/dist/safe-bash/command-chunks/{chunk-EFANWIHL.js → chunk-GY3BWK7K.js} +1 -0
  125. package/dist/safe-bash/command-chunks/{chunk-PPNBNFAU.js → chunk-GYQ2HAKQ.js} +8 -8
  126. package/dist/safe-bash/command-chunks/{chunk-PJJUYO3R.js → chunk-II77KPZN.js} +2 -2
  127. package/dist/safe-bash/command-chunks/{chunk-VL67NWNS.js → chunk-JDYXY44P.js} +2 -2
  128. package/dist/safe-bash/command-chunks/{chunk-4QJOYXVB.js → chunk-JV7LBUTP.js} +1 -1
  129. package/dist/safe-bash/command-chunks/{chunk-IKS2YXZQ.js → chunk-K67MWWWH.js} +3 -3
  130. package/dist/safe-bash/command-chunks/{chunk-BKCNF5U3.js → chunk-KQLD3AED.js} +2 -2
  131. package/dist/safe-bash/command-chunks/{chunk-UMDIOL3O.js → chunk-KXU3IRUO.js} +1 -1
  132. package/dist/safe-bash/command-chunks/{chunk-QZF3SINC.js → chunk-LAOM65EE.js} +2 -2
  133. package/dist/safe-bash/command-chunks/{chunk-HFII3QYO.js → chunk-LWS62ISU.js} +46 -32
  134. package/dist/safe-bash/command-chunks/{chunk-BZDDAPSV.js → chunk-LWSBAWLT.js} +1 -1
  135. package/dist/safe-bash/command-chunks/{chunk-U6G67N23.js → chunk-MIXBO6U7.js} +18 -5
  136. package/dist/safe-bash/command-chunks/{chunk-JQ74HC37.js → chunk-MQFIPHIQ.js} +23 -50
  137. package/dist/safe-bash/command-chunks/{chunk-ZJBR5Q5I.js → chunk-MSFXC3OC.js} +4 -4
  138. package/dist/safe-bash/command-chunks/{chunk-NI7MKJPN.js → chunk-MTQH74CF.js} +3 -55
  139. package/dist/safe-bash/command-chunks/chunk-MWUZZWXK.js +354 -0
  140. package/dist/safe-bash/command-chunks/{chunk-RVLO4DYT.js → chunk-N4PFUSRM.js} +1 -1
  141. package/dist/safe-bash/command-chunks/{chunk-WBNZ4PRE.js → chunk-NGG2XL56.js} +7 -4
  142. package/dist/safe-bash/command-chunks/{chunk-D4OP2BR3.js → chunk-NKFYQSES.js} +1 -2
  143. package/dist/safe-bash/command-chunks/{chunk-NGWB2YBL.js → chunk-O4JQSB7O.js} +1 -1
  144. package/dist/safe-bash/command-chunks/{chunk-GLOZX57Y.js → chunk-OQKC5ZU2.js} +23 -114
  145. package/dist/safe-bash/command-chunks/{chunk-7L24L4UO.js → chunk-OQU6UT6X.js} +2 -20
  146. package/dist/safe-bash/command-chunks/{chunk-TYCGMRLM.js → chunk-OYYV7ZAF.js} +1 -1
  147. package/dist/safe-bash/command-chunks/{chunk-SVULUDOP.js → chunk-P2N33UMN.js} +20 -81
  148. package/dist/safe-bash/command-chunks/{chunk-Q7Q5GM5S.js → chunk-P5APDEFB.js} +2 -2
  149. package/dist/safe-bash/command-chunks/{chunk-3HXDA5PT.js → chunk-PMBFZXTK.js} +1 -1
  150. package/dist/safe-bash/command-chunks/{chunk-4Y3WVMK4.js → chunk-PV66YWHB.js} +1 -0
  151. package/dist/safe-bash/command-chunks/{chunk-AXK3H4PX.js → chunk-QJ33BHI4.js} +1 -1
  152. package/dist/safe-bash/command-chunks/{chunk-3LSOYLNV.js → chunk-QKFSRZGQ.js} +2 -2
  153. package/dist/safe-bash/command-chunks/{chunk-JZSNU2MY.js → chunk-QKJLP53H.js} +2 -2
  154. package/dist/safe-bash/command-chunks/{chunk-LC2MFKT4.js → chunk-RMWQAAO5.js} +24 -25
  155. package/dist/safe-bash/command-chunks/{chunk-QDTBMSBE.js → chunk-RO62EWX6.js} +2 -2
  156. package/dist/safe-bash/command-chunks/{chunk-4C6QI5BQ.js → chunk-RZZI24ZE.js} +4 -4
  157. package/dist/safe-bash/command-chunks/{chunk-PFAADCB5.js → chunk-SDNBCQ3X.js} +10 -24
  158. package/dist/safe-bash/command-chunks/{chunk-36O5OT7E.js → chunk-T35Y7YQD.js} +1 -1
  159. package/dist/safe-bash/command-chunks/{chunk-6HMX4CQS.js → chunk-TGSNCQSR.js} +44 -16
  160. package/dist/safe-bash/command-chunks/{chunk-5T7CRJHW.js → chunk-TIOCQVUQ.js} +4 -7
  161. package/dist/safe-bash/command-chunks/{chunk-GN2TKLE7.js → chunk-TS65BJHG.js} +5 -5
  162. package/dist/safe-bash/command-chunks/{chunk-7RGB363W.js → chunk-TSCGT46G.js} +3 -2
  163. package/dist/safe-bash/command-chunks/{chunk-KBEURXFF.js → chunk-UN6WS55J.js} +3 -3
  164. package/dist/safe-bash/command-chunks/{chunk-SX2X3IH4.js → chunk-V2V5OCL3.js} +1 -1
  165. package/dist/safe-bash/command-chunks/{chunk-ERYJLO6G.js → chunk-V7A7DRTU.js} +1 -1
  166. package/dist/safe-bash/command-chunks/{chunk-5SHGJ7NO.js → chunk-VA5ZHYYA.js} +73 -33
  167. package/dist/safe-bash/command-chunks/{chunk-XETLEHZP.js → chunk-VPR5LQYX.js} +3 -2
  168. package/dist/safe-bash/command-chunks/{chunk-3DT2YOGW.js → chunk-VSRGNQCP.js} +3 -3
  169. package/dist/safe-bash/command-chunks/{chunk-N2F74VRO.js → chunk-VT6MJBEI.js} +1 -1
  170. package/dist/safe-bash/command-chunks/{chunk-J5SN3PZ3.js → chunk-VXSLJH7G.js} +53 -3
  171. package/dist/safe-bash/command-chunks/{chunk-PXYOWWMV.js → chunk-W7RAD4EW.js} +4 -3
  172. package/dist/safe-bash/command-chunks/{chunk-YGC6OS5O.js → chunk-WECIOOQB.js} +5 -8
  173. package/dist/safe-bash/command-chunks/{chunk-HHP343KT.js → chunk-WTECBRU4.js} +1 -1
  174. package/dist/safe-bash/command-chunks/{chunk-AO6Z5EQ7.js → chunk-WVE64WM2.js} +6 -5
  175. package/dist/safe-bash/command-chunks/{chunk-Z7RVSD5K.js → chunk-WVHONVZ4.js} +1 -1
  176. package/dist/safe-bash/command-chunks/{chunk-HLGKIZ25.js → chunk-X54L3DBL.js} +6 -9
  177. package/dist/safe-bash/command-chunks/{chunk-QNIMV57G.js → chunk-XNLFHHOC.js} +1 -1
  178. package/dist/safe-bash/command-chunks/{chunk-XAFSZDY2.js → chunk-XS72HTMA.js} +11 -0
  179. package/dist/safe-bash/command-chunks/{chunk-KYSPGS33.js → chunk-YIQACGEW.js} +2 -0
  180. package/dist/safe-bash/command-chunks/{chunk-NAY27PXB.js → chunk-YOFC45RK.js} +1 -1
  181. package/dist/safe-bash/command-chunks/{chunk-T5H5UJQ3.js → chunk-YVNGTIJO.js} +1 -1
  182. package/dist/safe-bash/command-chunks/{chunk-QI7LGHJJ.js → chunk-Z45N42QC.js} +21 -6
  183. package/dist/safe-bash/command-chunks/{chunk-67IQF5GC.js → chunk-ZYHTWNAE.js} +23 -9
  184. package/dist/safe-bash/command-chunks/{chunk-STC3LEWJ.js → chunk-ZYXH3B66.js} +5 -3
  185. package/dist/safe-bash/commands/apply-patch/index.browser.js +14 -0
  186. package/dist/safe-bash/commands/archive/index.browser.js +36 -0
  187. package/dist/safe-bash/commands/bytes/compression/index.js +3 -2
  188. package/dist/safe-bash/commands/column/index.browser.js +12 -0
  189. package/dist/safe-bash/commands/copy-preserve.d.ts +1 -0
  190. package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
  191. package/dist/safe-bash/commands/docx/index.browser.js +1 -1
  192. package/dist/safe-bash/commands/du/index.browser.js +14 -0
  193. package/dist/safe-bash/commands/execution.js +19 -13
  194. package/dist/safe-bash/commands/expr/index.browser.js +12 -0
  195. package/dist/safe-bash/commands/factor/index.browser.js +2 -2
  196. package/dist/safe-bash/commands/file/index.browser.js +14 -0
  197. package/dist/safe-bash/commands/filesystem.d.ts +1 -1
  198. package/dist/safe-bash/commands/filesystem.js +26 -15
  199. package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
  200. package/dist/safe-bash/commands/grep-aliases/index.browser.js +14 -0
  201. package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
  202. package/dist/safe-bash/commands/html-to-markdown/index.browser.js +16 -0
  203. package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
  204. package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
  205. package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
  206. package/dist/safe-bash/commands/llm/index.browser.js +2 -2
  207. package/dist/safe-bash/commands/llm/providers/index.browser.js +1 -1
  208. package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
  209. package/dist/safe-bash/commands/media/index.browser.js +1 -1
  210. package/dist/safe-bash/commands/metadata/index.browser.js +21 -0
  211. package/dist/safe-bash/commands/network/curl.d.ts +1 -1
  212. package/dist/safe-bash/commands/network/curl.js +1 -3
  213. package/dist/safe-bash/commands/network/index.browser.js +4 -4
  214. package/dist/safe-bash/commands/network/platform-portable.d.ts +1 -5
  215. package/dist/safe-bash/commands/network/platform-portable.js +1 -26
  216. package/dist/safe-bash/commands/network/public.d.ts +2 -2
  217. package/dist/safe-bash/commands/network/public.js +2 -2
  218. package/dist/safe-bash/commands/network/transport.js +2 -2
  219. package/dist/safe-bash/commands/network/wget.d.ts +1 -1
  220. package/dist/safe-bash/commands/network/wget.js +1 -3
  221. package/dist/safe-bash/commands/node/filesystem.js +3 -2
  222. package/dist/safe-bash/commands/node/index.browser.js +8 -8
  223. package/dist/safe-bash/commands/node/types.js +1 -1
  224. package/dist/safe-bash/commands/op/index.browser.js +3 -3
  225. package/dist/safe-bash/commands/pr/index.browser.js +2 -2
  226. package/dist/safe-bash/commands/python/host-capabilities.js +31 -14
  227. package/dist/safe-bash/commands/python/index.browser.js +11 -11
  228. package/dist/safe-bash/commands/python/manifest.d.ts +1 -0
  229. package/dist/safe-bash/commands/python/manifest.js +6 -3
  230. package/dist/safe-bash/commands/python/shell-capability.d.ts +1 -0
  231. package/dist/safe-bash/commands/python/shell-capability.js +3 -2
  232. package/dist/safe-bash/commands/python/worker.browser.js +3 -3
  233. package/dist/safe-bash/commands/regex-execution/public.browser.js +8 -6
  234. package/dist/safe-bash/commands/safejs/runtime.js +16 -7
  235. package/dist/safe-bash/commands/split/index.browser.js +14 -0
  236. package/dist/safe-bash/commands/standard.d.ts +1 -0
  237. package/dist/safe-bash/commands/standard.js +2 -1
  238. package/dist/safe-bash/commands/stream-format/index.browser.js +11 -0
  239. package/dist/safe-bash/commands/stream-inspection/index.browser.js +11 -0
  240. package/dist/safe-bash/commands/streams.js +11 -29
  241. package/dist/safe-bash/commands/table-text/index.browser.js +11 -0
  242. package/dist/safe-bash/commands/text.js +269 -496
  243. package/dist/safe-bash/commands/time-env/index.browser.js +15 -0
  244. package/dist/safe-bash/commands/tree/index.browser.js +14 -0
  245. package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
  246. package/dist/safe-bash/commands/xml/index.browser.js +2 -2
  247. package/dist/safe-bash/commands/yq/index.browser.js +2 -2
  248. package/dist/safe-bash/core.browser.js +1 -1
  249. package/dist/safe-bash/core.d.ts +6 -1
  250. package/dist/safe-bash/core.js +1 -1
  251. package/dist/safe-bash/full-core.browser.js +308 -295
  252. package/dist/safe-bash/jobs.browser.js +5 -5
  253. package/dist/safe-bash/opt-in/commands/dd/index.js +2 -0
  254. package/dist/safe-bash/opt-in/optional/commands/shuf/options.d.ts +1 -0
  255. package/dist/safe-bash/opt-in/optional/commands/shuf/options.js +2 -4
  256. package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +2 -1
  257. package/dist/safe-bash/optional-host.browser.js +15 -15
  258. package/dist/safe-bash/plugins/composition.d.ts +1 -0
  259. package/dist/safe-bash/plugins/composition.js +3 -8
  260. package/dist/safe-bash/plugins/index.browser.js +41 -27
  261. package/dist/safe-bash/registry-entry.browser.js +42 -28
  262. package/dist/safe-bash/search.browser.js +48 -0
  263. package/dist/safe-bash/shell/arrays/bindings.js +1 -1
  264. package/dist/safe-bash/shell/arrays/state.js +4 -0
  265. package/dist/safe-bash/shell/brace-expansion.js +1 -1
  266. package/dist/safe-bash/shell/dynamic-variables.d.ts +10 -0
  267. package/dist/safe-bash/shell/dynamic-variables.js +25 -0
  268. package/dist/safe-bash/shell/parser.js +8 -1
  269. package/dist/safe-bash/shell/runtime.d.ts +4 -13
  270. package/dist/safe-bash/shell/runtime.js +334 -1049
  271. package/dist/safe-bash/shell/shell.js +2 -54
  272. package/dist/safe-bash/shell-entry.browser.js +35 -26
  273. package/dist/safe-bash/trap.browser.js +4 -4
  274. package/dist/safe-bash/yq-browser/index.js +1 -1
  275. package/dist/safe-bash-base-encoding-engine/base.js +2 -2
  276. package/dist/safe-bash-base-encoding-engine/shared.js +1 -1
  277. package/dist/safe-bash-byte-input-engine/index.d.ts +3 -2
  278. package/dist/safe-bash-byte-input-engine/index.js +4 -1
  279. package/dist/safe-bash-checksum-engine/index.js +13 -6
  280. package/dist/safe-bash-command-apply-patch/apply.d.ts +1 -1
  281. package/dist/safe-bash-command-apply-patch/apply.js +4 -3
  282. package/dist/safe-bash-command-apply-patch/index.js +3 -3
  283. package/dist/safe-bash-command-apply-patch/matcher.js +1 -1
  284. package/dist/safe-bash-command-apply-patch/parser.js +1 -1
  285. package/dist/safe-bash-command-awk/awk-inspection.js +2 -2
  286. package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
  287. package/dist/safe-bash-command-awk/awk-syntax.d.ts +1 -1
  288. package/dist/safe-bash-command-awk/awk-syntax.js +2 -2
  289. package/dist/safe-bash-command-awk/awk-values.js +1 -1
  290. package/dist/safe-bash-command-awk/awk.js +5 -5
  291. package/dist/safe-bash-command-awk/index.js +5 -5
  292. package/dist/safe-bash-command-bc/index.d.ts +2 -0
  293. package/dist/safe-bash-command-bc/index.js +123 -92
  294. package/dist/safe-bash-command-column/column.js +5 -5
  295. package/dist/safe-bash-command-column/display.d.ts +1 -1
  296. package/dist/safe-bash-command-column/display.js +1 -1
  297. package/dist/safe-bash-command-column/index.js +5 -5
  298. package/dist/safe-bash-command-column/internal.d.ts +0 -2
  299. package/dist/safe-bash-command-column/internal.js +1 -1
  300. package/dist/safe-bash-command-column/layout.js +4 -4
  301. package/dist/safe-bash-command-column/table.js +2 -2
  302. package/dist/safe-bash-command-comm/comm.js +1 -1
  303. package/dist/safe-bash-command-comm/index.js +1 -1
  304. package/dist/safe-bash-command-csvcut/index.d.ts +1 -0
  305. package/dist/safe-bash-command-csvcut/index.js +1 -0
  306. package/dist/safe-bash-command-csvgrep/index.d.ts +1 -0
  307. package/dist/safe-bash-command-csvgrep/index.js +2 -2
  308. package/dist/safe-bash-command-csvkit/index.js +9 -9
  309. package/dist/safe-bash-command-csvkit/sync-support.js +1 -1
  310. package/dist/safe-bash-command-curl/curl.js +1 -1
  311. package/dist/safe-bash-command-curl/index.js +1 -1
  312. package/dist/safe-bash-command-dd/index.js +2 -0
  313. package/dist/safe-bash-command-diff/diff.js +1 -1
  314. package/dist/safe-bash-command-diff/index.js +1 -1
  315. package/dist/safe-bash-command-exiftool/index.d.ts +1 -0
  316. package/dist/safe-bash-command-fd/index.js +9 -9
  317. package/dist/safe-bash-command-ffmpeg/index.js +31 -8
  318. package/dist/safe-bash-command-file/index.js +1 -1
  319. package/dist/safe-bash-command-file/shared.js +1 -1
  320. package/dist/safe-bash-command-find/find.js +1 -1
  321. package/dist/safe-bash-command-find/index.js +1 -1
  322. package/dist/safe-bash-command-gzip/index.js +3 -2
  323. package/dist/safe-bash-command-hexdump/command.js +4 -4
  324. package/dist/safe-bash-command-hexdump/custom.d.ts +24 -0
  325. package/dist/safe-bash-command-hexdump/index.js +4 -4
  326. package/dist/safe-bash-command-hexdump/internal.d.ts +2 -0
  327. package/dist/safe-bash-command-hexdump/internal.js +1 -1
  328. package/dist/safe-bash-command-hexdump/io.js +2 -2
  329. package/dist/safe-bash-command-hexdump/options.d.ts +3 -0
  330. package/dist/safe-bash-command-hexdump/options.js +2 -2
  331. package/dist/safe-bash-command-hostname/index.js +1 -1
  332. package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
  333. package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
  334. package/dist/safe-bash-command-html-to-markdown/index.js +6 -6
  335. package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
  336. package/dist/safe-bash-command-html-to-markdown/parser.d.ts +1 -0
  337. package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
  338. package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
  339. package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
  340. package/dist/safe-bash-command-htmlq/index.d.ts +1 -0
  341. package/dist/safe-bash-command-htmlq/index.js +27 -9
  342. package/dist/safe-bash-command-iconv/codec.js +1 -1
  343. package/dist/safe-bash-command-iconv/command.js +2 -2
  344. package/dist/safe-bash-command-iconv/index.js +2 -2
  345. package/dist/safe-bash-command-imagemagick/index.js +24 -6
  346. package/dist/safe-bash-command-join/index.js +1 -1
  347. package/dist/safe-bash-command-join/join.js +1 -1
  348. package/dist/safe-bash-command-jq/index.js +1 -1
  349. package/dist/safe-bash-command-jq/jq.js +1 -1
  350. package/dist/safe-bash-command-less/index.js +43 -28
  351. package/dist/safe-bash-command-mmdc/index.d.ts +1 -0
  352. package/dist/safe-bash-command-nl/index.js +1 -1
  353. package/dist/safe-bash-command-nl/nl.js +1 -1
  354. package/dist/safe-bash-command-numfmt/index.js +0 -11
  355. package/dist/safe-bash-command-od/index.js +101 -68
  356. package/dist/safe-bash-command-pandoc/command.js +1 -1
  357. package/dist/safe-bash-command-pandoc/index.js +1 -1
  358. package/dist/safe-bash-command-paste/index.js +1 -1
  359. package/dist/safe-bash-command-paste/paste.js +1 -1
  360. package/dist/safe-bash-command-pathchk/index.js +3 -13
  361. package/dist/safe-bash-command-pdfimages/index.js +27 -11
  362. package/dist/safe-bash-command-pdfinfo/index.js +19 -10
  363. package/dist/safe-bash-command-pdftk/index.js +3 -3
  364. package/dist/safe-bash-command-pdftoppm/index.js +26 -10
  365. package/dist/safe-bash-command-pdftotext/index.js +27 -13
  366. package/dist/safe-bash-command-qpdf/index.js +5 -5
  367. package/dist/safe-bash-command-rg/index.js +1 -1
  368. package/dist/safe-bash-command-rg/rg-command.d.ts +0 -1
  369. package/dist/safe-bash-command-rg/rg-command.js +3 -5
  370. package/dist/safe-bash-command-sed/index.js +1 -1
  371. package/dist/safe-bash-command-sed/sed.js +1 -1
  372. package/dist/safe-bash-command-shuf/options.d.ts +1 -0
  373. package/dist/safe-bash-command-shuf/options.js +2 -4
  374. package/dist/safe-bash-command-shuf/shuf.js +2 -1
  375. package/dist/safe-bash-command-soffice/index.js +20 -16
  376. package/dist/safe-bash-command-split/index.js +3 -3
  377. package/dist/safe-bash-command-split/io.js +1 -1
  378. package/dist/safe-bash-command-split/outputs.js +2 -2
  379. package/dist/safe-bash-command-split/split.js +3 -3
  380. package/dist/safe-bash-command-sqlite3/btree.d.ts +1 -0
  381. package/dist/safe-bash-command-sqlite3/engine.d.ts +6 -0
  382. package/dist/safe-bash-command-sqlite3/index.js +284 -85
  383. package/dist/safe-bash-command-ssconvert/commands.js +9 -9
  384. package/dist/safe-bash-command-ssconvert/core.js +8 -8
  385. package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
  386. package/dist/safe-bash-command-ssconvert/formats/ods.js +8 -8
  387. package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +2 -2
  388. package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -9
  389. package/dist/safe-bash-command-ssconvert/formats/xlsx.js +8 -8
  390. package/dist/safe-bash-command-ssconvert/index.js +20 -20
  391. package/dist/safe-bash-command-tar/extract.js +1 -1
  392. package/dist/safe-bash-command-tar/index.js +5 -4
  393. package/dist/safe-bash-command-tar/modes.js +2 -2
  394. package/dist/safe-bash-command-tree/arguments.js +3 -3
  395. package/dist/safe-bash-command-tree/charset.js +1 -1
  396. package/dist/safe-bash-command-tree/index.js +4 -4
  397. package/dist/safe-bash-command-tree/io.js +1 -1
  398. package/dist/safe-bash-command-tree/pattern.js +2 -2
  399. package/dist/safe-bash-command-tree/tree.js +4 -4
  400. package/dist/safe-bash-command-unexpand/index.js +1 -1
  401. package/dist/safe-bash-command-unexpand/unexpand.js +1 -1
  402. package/dist/safe-bash-command-unrtf/index.js +14 -7
  403. package/dist/safe-bash-command-unzip/index.js +1 -1
  404. package/dist/safe-bash-command-unzip/unzip.js +1 -1
  405. package/dist/safe-bash-command-wget/index.js +1 -1
  406. package/dist/safe-bash-command-wget/wget.js +1 -1
  407. package/dist/safe-bash-command-xan/argv.d.ts +1 -1
  408. package/dist/safe-bash-command-xan/argv.js +1 -1
  409. package/dist/safe-bash-command-xan/commands.js +5 -3
  410. package/dist/safe-bash-command-xan/csv.d.ts +1 -1
  411. package/dist/safe-bash-command-xan/csv.js +1 -1
  412. package/dist/safe-bash-command-xan/index.js +7 -7
  413. package/dist/safe-bash-command-xan/io.js +3 -3
  414. package/dist/safe-bash-command-xmllint/index.js +1 -1
  415. package/dist/safe-bash-command-xxd/index.js +105 -91
  416. package/dist/safe-bash-command-xz/command.d.ts +2 -0
  417. package/dist/safe-bash-command-xz/index.d.ts +1 -1
  418. package/dist/safe-bash-command-xz/index.js +8 -0
  419. package/dist/safe-bash-command-yq/query.js +1 -1
  420. package/dist/safe-bash-command-zip/index.js +1 -1
  421. package/dist/safe-bash-command-zip/zip.js +1 -1
  422. package/dist/safe-bash-contracts/escaping.js +3 -3
  423. package/dist/safe-bash-contracts/filesystem-output.js +2 -2
  424. package/dist/safe-bash-contracts/index.d.ts +1 -0
  425. package/dist/safe-bash-contracts/index.js +7 -3
  426. package/dist/safe-bash-contracts/io.d.ts +4 -1
  427. package/dist/safe-bash-contracts/io.js +3 -1
  428. package/dist/safe-bash-contracts/managed-abort.d.ts +10 -0
  429. package/dist/safe-bash-contracts/output.js +2 -2
  430. package/dist/safe-bash-diff-engine/index.js +1 -1
  431. package/dist/safe-bash-diff-engine/shared.d.ts +3 -2
  432. package/dist/safe-bash-diff-engine/shared.js +1 -1
  433. package/dist/safe-bash-io-engine/commands/archive/internal.js +5 -23
  434. package/dist/safe-bash-io-engine/commands/search/requirements.js +2 -2
  435. package/dist/safe-bash-io-engine/commands/text-programs/shared.js +33 -44
  436. package/dist/safe-bash-io-engine/internal.js +1 -1
  437. package/dist/safe-bash-io-engine/shell/pattern.js +1 -1
  438. package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
  439. package/dist/safe-bash-mcp/index.browser.d.ts +155 -35
  440. package/dist/safe-bash-mcp/index.browser.js +416 -0
  441. package/dist/safe-bash-mcp/index.d.ts +54 -2
  442. package/dist/safe-bash-mcp/index.js +286 -90
  443. package/dist/safe-bash-network-engine/aggregate.js +2 -2
  444. package/dist/safe-bash-network-engine/args.js +4 -4
  445. package/dist/safe-bash-network-engine/authorizer.js +1 -1
  446. package/dist/safe-bash-network-engine/body.js +6 -6
  447. package/dist/safe-bash-network-engine/decode.d.ts +1 -1
  448. package/dist/safe-bash-network-engine/decode.js +3 -4
  449. package/dist/safe-bash-network-engine/fetch-transport.js +3 -3
  450. package/dist/safe-bash-network-engine/form-content-type.js +2 -2
  451. package/dist/safe-bash-network-engine/form-headers.js +2 -2
  452. package/dist/safe-bash-network-engine/glob.js +1 -1
  453. package/dist/safe-bash-network-engine/index.js +4 -4
  454. package/dist/safe-bash-network-engine/input.js +6 -6
  455. package/dist/safe-bash-network-engine/output.js +2 -2
  456. package/dist/safe-bash-network-engine/platform-portable.js +3 -3
  457. package/dist/safe-bash-network-engine/shared.js +2 -2
  458. package/dist/safe-bash-network-engine/types.d.ts +7 -2
  459. package/dist/safe-bash-network-engine/types.js +1 -1
  460. package/dist/safe-bash-network-engine/url.js +2 -2
  461. package/dist/safe-bash-query-engine/capture.js +3 -3
  462. package/dist/safe-bash-query-engine/delpaths.js +3 -3
  463. package/dist/safe-bash-query-engine/formats.js +2 -2
  464. package/dist/safe-bash-query-engine/index.js +11 -11
  465. package/dist/safe-bash-query-engine/indices.js +3 -3
  466. package/dist/safe-bash-query-engine/input.js +1 -1
  467. package/dist/safe-bash-query-engine/interpreter.js +9 -9
  468. package/dist/safe-bash-query-engine/parser.js +1 -1
  469. package/dist/safe-bash-query-engine/query-core.js +11 -11
  470. package/dist/safe-bash-query-engine/regex.js +4 -4
  471. package/dist/safe-bash-query-engine/splits.js +5 -5
  472. package/dist/safe-bash-query-engine/values.js +2 -2
  473. package/dist/safe-bash-regex-engine/ere/matcher.js +102 -30
  474. package/dist/safe-bash-regex-engine/execution/bounded-provider.js +55 -67
  475. package/dist/safe-bash-regex-engine/execution/portable.d.ts +0 -1
  476. package/dist/safe-bash-regex-engine/execution/portable.js +6 -10
  477. package/dist/safe-bash-regex-engine/execution/protocol.d.ts +0 -5
  478. package/dist/safe-bash-regex-engine/execution/protocol.js +1 -3
  479. package/dist/safe-bash-regex-engine/index.js +6 -4
  480. package/dist/safe-bash-regex-engine/text/budget.d.ts +1 -1
  481. package/dist/safe-bash-regex-engine/text/budget.js +1 -1
  482. package/dist/safe-bash-regex-engine/text/regex.d.ts +14 -0
  483. package/dist/safe-bash-regex-engine/text/regex.js +6 -4
  484. package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
  485. package/dist/safe-bash-regex-engine/text/rust-syntax.js +2 -2
  486. package/dist/safe-bash-search-engine/grep.js +189 -227
  487. package/dist/safe-bash-table-text-engine/table-text/internal.d.ts +7 -5
  488. package/dist/safe-bash-table-text-engine/table-text/internal.js +39 -21
  489. package/dist/safe-playwright-cloudflare/browser-trace-budget.js +6 -2
  490. package/dist/spreadsheet-engine/codecs/odf-hyperlinks.js +8 -2
  491. package/dist/spreadsheet-engine/formulas/functions/captured-bessel-phase.js +2 -2
  492. package/dist/spreadsheet-engine/formulas/label-references.js +54 -33
  493. package/dist/spreadsheet-engine/formulas/parser.js +3 -1
  494. package/dist/spreadsheet-engine/formulas/rewriting.js +13 -3
  495. package/dist/spreadsheet-format-xls/biff-data-tables.js +4 -6
  496. package/dist/spreadsheet-format-xls/biff-formulas.js +3 -0
  497. package/dist/spreadsheet-format-xls/biff-label-ranges.js +9 -6
  498. package/dist/spreadsheet-format-xls/biff.js +1 -1
  499. package/dist/xlsx-ast/xlsx.js +8 -5
  500. package/package.json +68 -12
  501. package/dist/safe-bash/command-chunks/chunk-KAGBORIC.js +0 -88
  502. /package/dist/safe-bash/command-chunks/{chunk-BWNXWI33.js → chunk-2LMZVE3I.js} +0 -0
@@ -1,137 +1,153 @@
1
1
  import {
2
2
  createFactorCommands
3
- } from "./chunk-MHZ24KEI.js";
3
+ } from "./chunk-AM5ESLPH.js";
4
4
  import {
5
5
  createHexdumpCommands
6
- } from "./chunk-M4CFCXHN.js";
6
+ } from "./chunk-CS4MNM6I.js";
7
7
  import {
8
8
  createTimeoutCommands
9
- } from "./chunk-SOZK5JVX.js";
9
+ } from "./chunk-FBUCWVTE.js";
10
10
  import {
11
11
  createTsortCommands
12
- } from "./chunk-T3JTVIEP.js";
12
+ } from "./chunk-6PAVEFT3.js";
13
+ import {
14
+ RegexExecutor
15
+ } from "./chunk-VKNVHEX3.js";
16
+ import {
17
+ Chi,
18
+ HashMD,
19
+ Maj,
20
+ abytes,
21
+ aexists,
22
+ ahash,
23
+ anumber,
24
+ aoutput,
25
+ checkOpts,
26
+ clean,
27
+ createHasher,
28
+ createOutputOperation,
29
+ createView,
30
+ kdfInputToBytes,
31
+ rotl,
32
+ sha256,
33
+ sha384,
34
+ sha512
35
+ } from "./chunk-HZAMGT5I.js";
36
+ import {
37
+ createColumnCommands
38
+ } from "./chunk-3HQU4OJO.js";
39
+ import {
40
+ createApplyPatchCommands
41
+ } from "./chunk-XAQMU6OY.js";
13
42
  import {
14
43
  assertCommandRequirements,
15
44
  basicCommands,
16
45
  cmpCommand,
17
- createArchiveCommands,
18
- createBcCommands,
19
46
  createCalCommands,
20
47
  createChecksumCommands,
21
48
  createCompressionCommands,
22
- createDdCommands,
23
49
  createDfCommands,
24
50
  createDiffPatchCommands,
25
- createDuCommands,
26
- createEnvsubstCommands,
27
51
  createFdCommands,
28
- createFileCommands,
29
52
  createFindDefinitions,
30
- createGetconfCommands,
31
- createHostnameCommands,
32
- createHtmlToMarkdownCommands,
33
- createIdCommands,
34
53
  createLessCommands,
35
- createLocaleCommands,
36
- createMetadataCommands,
37
- createNprocCommands,
38
- createNumfmtCommands,
39
54
  createPathchkCommands,
40
55
  createRgCommand,
41
- createShufCommands,
42
- createSpongeCommands,
43
- createSqlite3Commands,
44
- createStreamFormatCommands,
45
- createStreamInspectionCommands,
46
- createTimeEnvCommands,
47
- createTreeCommands,
48
- createUnameCommands,
49
56
  createWhichCommands,
50
- createWhoamiCommands,
51
57
  directExecutor,
52
58
  executionCommands,
53
59
  filesystemCommands,
54
60
  fmtCommand,
55
- numfmtCommand,
56
61
  openFileOutput,
57
62
  predicateCommands,
58
63
  wcDisplayWidth
59
- } from "./chunk-K4YMYFRJ.js";
64
+ } from "./chunk-44ALJ4QG.js";
60
65
  import {
61
66
  createGetoptCommands
62
- } from "./chunk-3L3T6LYV.js";
67
+ } from "./chunk-AUSNDQTJ.js";
63
68
  import {
64
69
  createIconvCommands
65
- } from "./chunk-H6JW3E4F.js";
70
+ } from "./chunk-CTVWDACF.js";
66
71
  import {
67
72
  createDos2unixCommands2 as createDos2unixCommands
68
- } from "./chunk-4SEW2Q6H.js";
73
+ } from "./chunk-3R3AANOR.js";
69
74
  import {
70
75
  createMdqCommand
71
- } from "./chunk-PPYM75Z3.js";
76
+ } from "./chunk-OV6IHKO6.js";
72
77
  import {
73
78
  compareCopyIdentity,
74
79
  compareObservedEntries,
75
80
  inputRequirements,
76
81
  resolveInputLimit,
77
82
  textOutputRequirements
78
- } from "./chunk-LLZCZ24K.js";
83
+ } from "./chunk-XVOSKJE2.js";
79
84
  import {
80
85
  createXmlCommands
81
- } from "./chunk-K7IQZE7D.js";
86
+ } from "./chunk-C5OWC2TL.js";
82
87
  import {
83
88
  PublicDiagnostic
84
- } from "./chunk-TYD7EVUJ.js";
85
- import {
86
- compareByteArrays,
87
- decodeBytes,
88
- encodeBytes,
89
- equalBytes,
90
- indexOfBytes
91
- } from "./chunk-BHJE5LPZ.js";
89
+ } from "./chunk-PH63PLPZ.js";
92
90
  import {
93
91
  createPrCommands
94
- } from "./chunk-F3RV2F72.js";
92
+ } from "./chunk-CHYGPFVM.js";
95
93
  import {
96
- RegexExecutor,
97
94
  createBoundedRegexProvider
98
- } from "./chunk-6HZYFL3H.js";
95
+ } from "./chunk-FZE4HW6G.js";
99
96
  import {
100
- Chi,
101
- HashMD,
102
- Maj,
103
- abytes,
104
- aexists,
105
- ahash,
106
- anumber,
107
- aoutput,
108
- checkOpts,
109
- clean,
110
- createHasher,
111
- createOutputOperation,
112
- createView,
113
- kdfInputToBytes,
114
- rotl,
115
- sha256,
116
- sha384,
117
- sha512
118
- } from "./chunk-JJSTTIEZ.js";
97
+ CommandRegistry
98
+ } from "./chunk-7R5BDCG7.js";
99
+ import {
100
+ createTreeCommands
101
+ } from "./chunk-55YJASTN.js";
102
+ import {
103
+ createFileCommands
104
+ } from "./chunk-4BSJLKNM.js";
105
+ import {
106
+ createHtmlToMarkdownCommands
107
+ } from "./chunk-DQP3VHSB.js";
108
+ import {
109
+ createDuCommands
110
+ } from "./chunk-GEG3BWGE.js";
111
+ import {
112
+ createMetadataCommands
113
+ } from "./chunk-VSAJ4OTM.js";
114
+ import {
115
+ compareByteArrays,
116
+ decodeBytes,
117
+ encodeBytes,
118
+ indexOfBytes
119
+ } from "./chunk-D3ANYGMC.js";
119
120
  import {
120
121
  FsError
121
- } from "./chunk-46UISJCK.js";
122
+ } from "./chunk-VTH3MLDU.js";
122
123
  import {
123
124
  hasYieldCheckpoint,
124
125
  monotonicNow,
125
126
  yieldTurn
126
- } from "./chunk-VYZTG3GV.js";
127
+ } from "./chunk-NZQXYWA3.js";
127
128
  import {
128
129
  collectBytes,
129
130
  createBufferedOutput,
130
131
  outputFailure
131
- } from "./chunk-PYVEAFJM.js";
132
+ } from "./chunk-74GHTNJA.js";
132
133
  import {
133
- CommandRegistry
134
- } from "./chunk-LQHGH25W.js";
134
+ createArchiveCommands
135
+ } from "./chunk-QGUV42T5.js";
136
+ import {
137
+ createTableTextCommands
138
+ } from "./chunk-4D4N7IU2.js";
139
+ import {
140
+ createStreamInspectionCommands
141
+ } from "./chunk-HBCN24ZA.js";
142
+ import {
143
+ createStreamFormatCommands
144
+ } from "./chunk-R3NAKOED.js";
145
+ import {
146
+ createSplitCommands
147
+ } from "./chunk-7ZBU7KYV.js";
148
+ import {
149
+ createTimeEnvCommands
150
+ } from "./chunk-ZVD5IS4V.js";
135
151
  import {
136
152
  RESOLVED_EXIT_ZERO,
137
153
  RETURN_EXIT_ONE,
@@ -143,11 +159,13 @@ import {
143
159
  builtInDirectContextExecutors,
144
160
  codeOf,
145
161
  concatenate,
162
+ decoder,
146
163
  define,
147
164
  diagnostic,
148
165
  encoder,
149
166
  input,
150
167
  integer,
168
+ isDefaultCommandOptions,
151
169
  lines,
152
170
  options,
153
171
  output,
@@ -158,10 +176,39 @@ import {
158
176
  requireOperands,
159
177
  syncCommandEvaluators,
160
178
  value
161
- } from "./chunk-NLAW7KDI.js";
179
+ } from "./chunk-E7OYNDGL.js";
162
180
  import {
163
181
  init_platform
164
- } from "./chunk-YG5WAHK7.js";
182
+ } from "./chunk-B7TAL7S5.js";
183
+
184
+ // packages/safe-bash/src/commands/numfmt/index.ts
185
+ init_platform();
186
+ import {
187
+ createNumfmtCommand as createRawNumfmtCommand,
188
+ createNumfmtCommands as createRawNumfmtCommands
189
+ } from "../../safe-bash-command-numfmt/index.js";
190
+ import { numfmtCommand, settings } from "../../safe-bash-command-numfmt/index.js";
191
+ function createNumfmtCommand(options2 = {}) {
192
+ return registerDefaultExecutor(createRawNumfmtCommand(options2), options2);
193
+ }
194
+ function createNumfmtCommands(options2 = {}) {
195
+ return registerDefaultExecutors(createRawNumfmtCommands(options2), options2);
196
+ }
197
+ function numfmtCommands(options2 = {}) {
198
+ const commands = createNumfmtCommands(options2);
199
+ const replace = options2.replace ?? false;
200
+ return {
201
+ name: "numfmt-commands",
202
+ setup(host) {
203
+ if (!replace) {
204
+ for (const command of commands) {
205
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
206
+ }
207
+ }
208
+ for (const command of commands) host.commands.register(command, { replace });
209
+ }
210
+ };
211
+ }
165
212
 
166
213
  // packages/safe-bash/src/commands/text-programs/index.ts
167
214
  init_platform();
@@ -242,11 +289,11 @@ function odCommands(options2 = {}) {
242
289
  name: "od-commands",
243
290
  setup(host) {
244
291
  if (!replace) {
245
- for (const command2 of commands) {
246
- if (host.commands.has(command2.name)) throw new Error(`Command already registered: ${command2.name}`);
292
+ for (const command of commands) {
293
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
247
294
  }
248
295
  }
249
- for (const command2 of commands) host.commands.register(command2, { replace });
296
+ for (const command of commands) host.commands.register(command, { replace });
250
297
  }
251
298
  };
252
299
  }
@@ -272,11 +319,11 @@ function xxdCommands(options2 = {}) {
272
319
  name: "xxd-commands",
273
320
  setup(host) {
274
321
  if (!replace) {
275
- for (const command2 of commands) {
276
- if (host.commands.has(command2.name)) throw new Error(`Command already registered: ${command2.name}`);
322
+ for (const command of commands) {
323
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
277
324
  }
278
325
  }
279
- for (const command2 of commands) host.commands.register(command2, { replace });
326
+ for (const command of commands) host.commands.register(command, { replace });
280
327
  }
281
328
  };
282
329
  }
@@ -325,54 +372,112 @@ function byteCommands(options2 = {}) {
325
372
  };
326
373
  }
327
374
 
328
- // packages/safe-bash/src/commands/table-text/index.ts
329
- init_platform();
330
-
331
- // packages/safe-bash/src/commands/table-text/paste.ts
332
- init_platform();
333
- import { createPasteCommand } from "../../safe-bash-command-paste/paste.js";
334
-
335
- // packages/safe-bash/src/commands/table-text/comm.ts
336
- init_platform();
337
- import { createCommCommand } from "../../safe-bash-command-comm/comm.js";
338
-
339
- // packages/safe-bash/src/commands/table-text/join.ts
375
+ // packages/safe-bash/src/commands/bc/index.ts
340
376
  init_platform();
341
- import { createJoinCommand } from "../../safe-bash-command-join/join.js";
377
+ import {
378
+ createBcCommand as createRawBcCommand,
379
+ createBcCommands as createRawBcCommands
380
+ } from "../../safe-bash-command-bc/index.js";
381
+ import { settings as settings2 } from "../../safe-bash-command-bc/index.js";
382
+ function createBcCommand(options2 = {}) {
383
+ return registerDefaultExecutor(createRawBcCommand(options2), options2);
384
+ }
385
+ function createBcCommands(options2 = {}) {
386
+ return registerDefaultExecutors(createRawBcCommands(options2), options2);
387
+ }
388
+ function bcCommands(options2 = {}) {
389
+ const commands = createBcCommands(options2);
390
+ const replace = options2.replace ?? false;
391
+ return {
392
+ name: "bc-commands",
393
+ setup(host) {
394
+ if (!replace) {
395
+ for (const command of commands) {
396
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
397
+ }
398
+ }
399
+ for (const command of commands) host.commands.register(command, { replace });
400
+ }
401
+ };
402
+ }
342
403
 
343
- // packages/safe-bash/src/commands/table-text/internal.ts
404
+ // packages/safe-bash/src/commands/sponge/index.ts
344
405
  init_platform();
345
- import { Budget as Budget2, Inputs, OrderCheck, RecordReader, argument, command, compare, empty, encode, fail, settings } from "../../safe-bash-table-text-engine/table-text/internal.js";
346
-
347
- // packages/safe-bash/src/commands/table-text/index.ts
348
- function createTableTextCommands(options2 = {}) {
349
- settings(options2);
350
- const defs = [createPasteCommand(options2), createCommCommand(options2), createJoinCommand(options2)];
351
- for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
352
- return defs;
406
+ import {
407
+ createSpongeCommand as createRawSpongeCommand,
408
+ createSpongeCommands as createRawSpongeCommands,
409
+ spongeCommands as rawSpongeCommands,
410
+ settings as settings3
411
+ } from "../../safe-bash-command-sponge/index.js";
412
+ function evalSyncSponge(inBytes, opArgs, readFileSync, writeFileSync) {
413
+ let append = false;
414
+ const files = [];
415
+ let endOfOptions = false;
416
+ for (const arg of opArgs) {
417
+ if (!endOfOptions && arg === "--") {
418
+ endOfOptions = true;
419
+ continue;
420
+ }
421
+ if (!endOfOptions && arg === "--append") {
422
+ append = true;
423
+ continue;
424
+ }
425
+ if (!endOfOptions && (arg === "--help" || arg === "-h")) {
426
+ return "Usage: sponge [-a] [FILE]\nSoak up standard input and write to FILE (or stdout).\n";
427
+ }
428
+ if (!endOfOptions && arg === "--version") {
429
+ return "sponge (virtual-bash)\n";
430
+ }
431
+ if (!endOfOptions && arg.startsWith("-") && arg.length > 1) {
432
+ for (let i = 1; i < arg.length; i++) {
433
+ if (arg[i] === "a") append = true;
434
+ else return void 0;
435
+ }
436
+ continue;
437
+ }
438
+ files.push(arg);
439
+ }
440
+ if (files.length > 1) return void 0;
441
+ const payload = inBytes ?? new Uint8Array(0);
442
+ if (files.length === 0 || files[0] === "-") return decoder.decode(payload);
443
+ if (!writeFileSync) return void 0;
444
+ const target = files[0];
445
+ if (append) {
446
+ const existing = readFileSync?.(target) ?? new Uint8Array(0);
447
+ const combined = new Uint8Array(existing.length + payload.length);
448
+ combined.set(existing, 0);
449
+ combined.set(payload, existing.length);
450
+ if (!writeFileSync(target, combined)) return void 0;
451
+ } else {
452
+ if (!writeFileSync(target, payload)) return void 0;
453
+ }
454
+ return "";
353
455
  }
354
- function tableTextCommands(options2 = {}) {
355
- const commands = createTableTextCommands(options2);
356
- return { name: "table-text-commands", setup(host) {
357
- if (!options2.replace) for (const definition of commands) {
358
- if (host.commands.has(definition.name)) throw new Error(`Command already registered: ${definition.name}`);
456
+ syncCommandEvaluators.evalSyncSponge = evalSyncSponge;
457
+ function createSpongeCommand(options2 = {}) {
458
+ const def = createRawSpongeCommand(options2);
459
+ if (isDefaultCommandOptions(options2)) builtInDirectContextExecutors.add(def.execute);
460
+ return def;
461
+ }
462
+ function createSpongeCommands(options2 = {}) {
463
+ return createRawSpongeCommands(options2).map((def) => {
464
+ if (isDefaultCommandOptions(options2)) builtInDirectContextExecutors.add(def.execute);
465
+ return def;
466
+ });
467
+ }
468
+ function spongeCommands(options2 = {}) {
469
+ const plugin = rawSpongeCommands(options2);
470
+ return {
471
+ ...plugin,
472
+ setup(host) {
473
+ for (const def of createSpongeCommands(options2)) {
474
+ if (!options2.replace && host.commands.has(def.name)) throw new Error(`Command already registered: ${def.name}`);
475
+ host.commands.register(def, { replace: options2.replace ?? false });
476
+ }
359
477
  }
360
- for (const definition of commands) host.commands.register(definition, { replace: options2.replace ?? false });
361
- } };
478
+ };
362
479
  }
363
480
 
364
- // packages/safe-bash/src/commands/split/index.ts
365
- init_platform();
366
- import { createSplitCommand, createSplitCommands, evalSyncSplit, splitCommands } from "../../safe-bash-command-split/index.js";
367
-
368
- // packages/safe-bash/src/commands/column/index.ts
369
- init_platform();
370
- import { columnCommands, createColumnCommand, createColumnCommands } from "../../safe-bash-command-column/index.js";
371
-
372
- // packages/safe-bash/src/commands/apply-patch/index.ts
373
- init_platform();
374
- import { applyPatchCommands, createApplyPatchCommand, createApplyPatchCommands, evalSyncApplyPatch } from "../../safe-bash-command-apply-patch/index.js";
375
-
376
481
  // packages/safe-bash/src/commands/openssl/index.ts
377
482
  init_platform();
378
483
 
@@ -615,7 +720,7 @@ import {
615
720
  createOpensslCommand as createRawOpensslCommand,
616
721
  createOpensslCommands as createRawOpensslCommands
617
722
  } from "../../safe-bash-command-openssl/index.js";
618
- import { settings as settings2 } from "../../safe-bash-command-openssl/index.js";
723
+ import { settings as settings4 } from "../../safe-bash-command-openssl/index.js";
619
724
  function isDefaultOpensslOptions(options2) {
620
725
  if (!options2) return true;
621
726
  return options2.limits === void 0 && options2.maxBufferedBytes === void 0;
@@ -641,11 +746,11 @@ function opensslCommands(options2 = {}) {
641
746
  name: "openssl-commands",
642
747
  setup(host) {
643
748
  if (!replace) {
644
- for (const command2 of commands) {
645
- if (host.commands.has(command2.name)) throw new Error(`Command already registered: ${command2.name}`);
749
+ for (const command of commands) {
750
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
646
751
  }
647
752
  }
648
- for (const command2 of commands) host.commands.register(command2, { replace });
753
+ for (const command of commands) host.commands.register(command, { replace });
649
754
  }
650
755
  };
651
756
  }
@@ -1204,7 +1309,7 @@ import {
1204
1309
  createSshKeygenCommand as createRawSshKeygenCommand,
1205
1310
  createSshCommands as createRawSshCommands
1206
1311
  } from "../../safe-bash-command-ssh/index.js";
1207
- import { settings as settings3 } from "../../safe-bash-command-ssh/index.js";
1312
+ import { settings as settings5 } from "../../safe-bash-command-ssh/index.js";
1208
1313
  var ED25519_P = 2n ** 255n - 19n;
1209
1314
  var ED25519_L = 2n ** 252n + 27742317777372353535851937790883648493n;
1210
1315
  var edMod = (a, m = ED25519_P) => (a % m + m) % m;
@@ -1344,11 +1449,11 @@ function sshCommands(options2 = {}) {
1344
1449
  name: "ssh-commands",
1345
1450
  setup(host) {
1346
1451
  if (!replace) {
1347
- for (const command2 of commands) {
1348
- if (host.commands.has(command2.name)) throw new Error(`Command already registered: ${command2.name}`);
1452
+ for (const command of commands) {
1453
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
1349
1454
  }
1350
1455
  }
1351
- for (const command2 of commands) host.commands.register(command2, { replace });
1456
+ for (const command of commands) host.commands.register(command, { replace });
1352
1457
  }
1353
1458
  };
1354
1459
  }
@@ -1699,7 +1804,7 @@ import {
1699
1804
  createGpgCommand as createRawGpgCommand,
1700
1805
  createGpgCommands as createRawGpgCommands
1701
1806
  } from "../../safe-bash-command-gpg/index.js";
1702
- import { settings as settings4 } from "../../safe-bash-command-gpg/index.js";
1807
+ import { settings as settings6 } from "../../safe-bash-command-gpg/index.js";
1703
1808
  var ED25519_P2 = 2n ** 255n - 19n;
1704
1809
  var ED25519_L2 = 2n ** 252n + 27742317777372353535851937790883648493n;
1705
1810
  var edMod2 = (a, m = ED25519_P2) => (a % m + m) % m;
@@ -1808,11 +1913,11 @@ function gpgCommands(options2 = {}) {
1808
1913
  name: "gpg-commands",
1809
1914
  setup(host) {
1810
1915
  if (!replace) {
1811
- for (const command2 of commands) {
1812
- if (host.commands.has(command2.name)) throw new Error(`Command already registered: ${command2.name}`);
1916
+ for (const command of commands) {
1917
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
1813
1918
  }
1814
1919
  }
1815
- for (const command2 of commands) host.commands.register(command2, { replace });
1920
+ for (const command of commands) host.commands.register(command, { replace });
1816
1921
  }
1817
1922
  };
1818
1923
  }
@@ -1995,11 +2100,340 @@ ${pgpCrc24(pktBytes)}
1995
2100
  }
1996
2101
  syncCommandEvaluators.evalSyncGpg = evalSyncGpg;
1997
2102
 
2103
+ // packages/safe-bash/src/commands/id/index.ts
2104
+ init_platform();
2105
+ import {
2106
+ createIdCommand as createRawIdCommand,
2107
+ createIdCommands as createRawIdCommands
2108
+ } from "../../safe-bash-command-id/index.js";
2109
+ import { settings as settings7 } from "../../safe-bash-command-id/index.js";
2110
+ function createIdCommand(options2 = {}) {
2111
+ return registerDefaultExecutor(createRawIdCommand(options2), options2);
2112
+ }
2113
+ function createIdCommands(options2 = {}) {
2114
+ return registerDefaultExecutors(createRawIdCommands(options2), options2);
2115
+ }
2116
+ function idCommands(options2 = {}) {
2117
+ const commands = createIdCommands(options2);
2118
+ const replace = options2.replace ?? false;
2119
+ return {
2120
+ name: "id-commands",
2121
+ setup(host) {
2122
+ if (!replace) {
2123
+ for (const command of commands) {
2124
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
2125
+ }
2126
+ }
2127
+ for (const command of commands) host.commands.register(command, { replace });
2128
+ }
2129
+ };
2130
+ }
2131
+
2132
+ // packages/safe-bash/src/commands/whoami/index.ts
2133
+ init_platform();
2134
+ import {
2135
+ createWhoamiCommand as createRawWhoamiCommand,
2136
+ createWhoamiCommands as createRawWhoamiCommands
2137
+ } from "../../safe-bash-command-whoami/index.js";
2138
+ import { settings as settings8 } from "../../safe-bash-command-whoami/index.js";
2139
+ function createWhoamiCommand(options2 = {}) {
2140
+ return registerDefaultExecutor(createRawWhoamiCommand(options2), options2);
2141
+ }
2142
+ function createWhoamiCommands(options2 = {}) {
2143
+ return registerDefaultExecutors(createRawWhoamiCommands(options2), options2);
2144
+ }
2145
+ function whoamiCommands(options2 = {}) {
2146
+ const commands = createWhoamiCommands(options2);
2147
+ const replace = options2.replace ?? false;
2148
+ return {
2149
+ name: "whoami-commands",
2150
+ setup(host) {
2151
+ if (!replace) {
2152
+ for (const command of commands) {
2153
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
2154
+ }
2155
+ }
2156
+ for (const command of commands) host.commands.register(command, { replace });
2157
+ }
2158
+ };
2159
+ }
2160
+
2161
+ // packages/safe-bash/src/commands/uname/index.ts
2162
+ init_platform();
2163
+ import {
2164
+ createUnameCommand as createRawUnameCommand,
2165
+ createUnameCommands as createRawUnameCommands
2166
+ } from "../../safe-bash-command-uname/index.js";
2167
+ import { settings as settings9 } from "../../safe-bash-command-uname/index.js";
2168
+ function createUnameCommand(options2 = {}) {
2169
+ return registerDefaultExecutor(createRawUnameCommand(options2), options2);
2170
+ }
2171
+ function createUnameCommands(options2 = {}) {
2172
+ return registerDefaultExecutors(createRawUnameCommands(options2), options2);
2173
+ }
2174
+ function unameCommands(options2 = {}) {
2175
+ const commands = createUnameCommands(options2);
2176
+ const replace = options2.replace ?? false;
2177
+ return {
2178
+ name: "uname-commands",
2179
+ setup(host) {
2180
+ if (!replace) {
2181
+ for (const command of commands) {
2182
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
2183
+ }
2184
+ }
2185
+ for (const command of commands) host.commands.register(command, { replace });
2186
+ }
2187
+ };
2188
+ }
2189
+
2190
+ // packages/safe-bash/src/commands/hostname/index.ts
2191
+ init_platform();
2192
+ import {
2193
+ createHostnameCommand as createRawHostnameCommand,
2194
+ createHostnameCommands as createRawHostnameCommands
2195
+ } from "../../safe-bash-command-hostname/index.js";
2196
+ import { settings as settings10 } from "../../safe-bash-command-hostname/index.js";
2197
+ function createHostnameCommand(options2 = {}) {
2198
+ return registerDefaultExecutor(createRawHostnameCommand(options2), options2);
2199
+ }
2200
+ function createHostnameCommands(options2 = {}) {
2201
+ return registerDefaultExecutors(createRawHostnameCommands(options2), options2);
2202
+ }
2203
+ function hostnameCommands(options2 = {}) {
2204
+ const commands = createHostnameCommands(options2);
2205
+ const replace = options2.replace ?? false;
2206
+ return {
2207
+ name: "hostname-commands",
2208
+ setup(host) {
2209
+ if (!replace) {
2210
+ for (const command of commands) {
2211
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
2212
+ }
2213
+ }
2214
+ for (const command of commands) host.commands.register(command, { replace });
2215
+ }
2216
+ };
2217
+ }
2218
+
2219
+ // packages/safe-bash/src/commands/nproc/index.ts
2220
+ init_platform();
2221
+ import {
2222
+ createNprocCommand as createRawNprocCommand,
2223
+ createNprocCommands as createRawNprocCommands
2224
+ } from "../../safe-bash-command-nproc/index.js";
2225
+ import { settings as settings11 } from "../../safe-bash-command-nproc/index.js";
2226
+ function createNprocCommand(options2 = {}) {
2227
+ return registerDefaultExecutor(createRawNprocCommand(options2), options2);
2228
+ }
2229
+ function createNprocCommands(options2 = {}) {
2230
+ return registerDefaultExecutors(createRawNprocCommands(options2), options2);
2231
+ }
2232
+ function nprocCommands(options2 = {}) {
2233
+ const commands = createNprocCommands(options2);
2234
+ const replace = options2.replace ?? false;
2235
+ return {
2236
+ name: "nproc-commands",
2237
+ setup(host) {
2238
+ if (!replace) {
2239
+ for (const command of commands) {
2240
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
2241
+ }
2242
+ }
2243
+ for (const command of commands) host.commands.register(command, { replace });
2244
+ }
2245
+ };
2246
+ }
2247
+
2248
+ // packages/safe-bash/src/shuf.ts
2249
+ init_platform();
2250
+ import { createShufCommand, createShufCommands, shufCommands } from "../../safe-bash-command-shuf/index.js";
2251
+
1998
2252
  // packages/safe-bash/src/yes.ts
1999
2253
  init_platform();
2000
- import { settings as settings5 } from "../../safe-bash-command-yes/index.js";
2254
+ import { settings as settings12 } from "../../safe-bash-command-yes/index.js";
2001
2255
  import { createYesCommand, createYesCommands, yesCommands } from "../../safe-bash-command-yes/index.js";
2002
2256
 
2257
+ // packages/safe-bash/src/dd.ts
2258
+ init_platform();
2259
+ import {
2260
+ createDdCommand as createRawDdCommand,
2261
+ createDdCommands as createRawDdCommands
2262
+ } from "../../safe-bash-command-dd/index.js";
2263
+ import { evalSyncDd, openDdFile, settings as settings13, transferReport } from "../../safe-bash-command-dd/index.js";
2264
+ function createDdCommand(options2 = {}) {
2265
+ return registerDefaultExecutor(createRawDdCommand(options2), options2);
2266
+ }
2267
+ function createDdCommands(options2 = {}) {
2268
+ return registerDefaultExecutors(createRawDdCommands(options2), options2);
2269
+ }
2270
+ function ddCommands(options2 = {}) {
2271
+ const commands = createDdCommands(options2);
2272
+ const replace = options2.replace ?? false;
2273
+ return {
2274
+ name: "dd-commands",
2275
+ setup(host) {
2276
+ if (!replace) {
2277
+ for (const command of commands) {
2278
+ if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
2279
+ }
2280
+ }
2281
+ for (const command of commands) host.commands.register(command, { replace });
2282
+ }
2283
+ };
2284
+ }
2285
+
2286
+ // packages/safe-bash/src/commands/envsubst/index.ts
2287
+ init_platform();
2288
+ import {
2289
+ createEnvsubstCommand as createRawEnvsubstCommand,
2290
+ createEnvsubstCommands as createRawEnvsubstCommands,
2291
+ envsubstCommands as rawEnvsubstCommands
2292
+ } from "../../safe-bash-command-envsubst/index.js";
2293
+ import { settings as settings15 } from "../../safe-bash-command-envsubst/index.js";
2294
+ function createEnvsubstCommand(options2 = {}) {
2295
+ const def = createRawEnvsubstCommand(options2);
2296
+ builtInDirectContextExecutors.add(def.execute);
2297
+ return def;
2298
+ }
2299
+ function createEnvsubstCommands(options2 = {}) {
2300
+ const defs = createRawEnvsubstCommands(options2);
2301
+ for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
2302
+ return defs;
2303
+ }
2304
+ function envsubstCommands(options2 = {}) {
2305
+ createEnvsubstCommands(options2);
2306
+ return rawEnvsubstCommands(options2);
2307
+ }
2308
+
2309
+ // packages/safe-bash/src/commands/getconf/index.ts
2310
+ init_platform();
2311
+ import {
2312
+ createGetconfCommand as createRawGetconfCommand,
2313
+ createGetconfCommands as createRawGetconfCommands
2314
+ } from "../../safe-bash-command-getconf/index.js";
2315
+ import { settings as settings16 } from "../../safe-bash-command-getconf/index.js";
2316
+ function isDefaultGetconfOptions(options2) {
2317
+ return options2?.processors === void 0 && options2?.variables === void 0 && options2?.limits === void 0;
2318
+ }
2319
+ function createGetconfCommand(options2 = {}) {
2320
+ const def = createRawGetconfCommand(options2);
2321
+ if (isDefaultGetconfOptions(options2)) builtInDirectContextExecutors.add(def.execute);
2322
+ return def;
2323
+ }
2324
+ function createGetconfCommands(options2 = {}) {
2325
+ const defs = createRawGetconfCommands(options2);
2326
+ if (isDefaultGetconfOptions(options2)) {
2327
+ for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
2328
+ }
2329
+ return defs;
2330
+ }
2331
+ function getconfCommands(options2 = {}) {
2332
+ const commands = createGetconfCommands(options2);
2333
+ return {
2334
+ name: "getconf-commands",
2335
+ setup(host) {
2336
+ if (!options2.replace) {
2337
+ for (const command of commands) {
2338
+ if (host.commands.has(command.name)) {
2339
+ throw new Error(`Command already registered: ${command.name}`);
2340
+ }
2341
+ }
2342
+ }
2343
+ for (const command of commands) {
2344
+ host.commands.register(command, { replace: options2.replace ?? false });
2345
+ }
2346
+ }
2347
+ };
2348
+ }
2349
+
2350
+ // packages/safe-bash/src/commands/locale/index.ts
2351
+ init_platform();
2352
+ import {
2353
+ createLocaleCommand as createRawLocaleCommand,
2354
+ createLocaleCommands as createRawLocaleCommands
2355
+ } from "../../safe-bash-command-locale/index.js";
2356
+ import { settings as settings17 } from "../../safe-bash-command-locale/index.js";
2357
+ function isDefaultLocaleOptions(options2) {
2358
+ return options2?.locales === void 0 && options2?.charmaps === void 0 && options2?.defaultLocale === void 0 && options2?.limits === void 0;
2359
+ }
2360
+ function createLocaleCommand(options2 = {}) {
2361
+ const def = createRawLocaleCommand(options2);
2362
+ if (isDefaultLocaleOptions(options2)) builtInDirectContextExecutors.add(def.execute);
2363
+ return def;
2364
+ }
2365
+ function createLocaleCommands(options2 = {}) {
2366
+ const defs = createRawLocaleCommands(options2);
2367
+ if (isDefaultLocaleOptions(options2)) {
2368
+ for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
2369
+ }
2370
+ return defs;
2371
+ }
2372
+ function localeCommands(options2 = {}) {
2373
+ const commands = createLocaleCommands(options2);
2374
+ return {
2375
+ name: "locale-commands",
2376
+ setup(host) {
2377
+ if (!options2.replace) {
2378
+ for (const command of commands) {
2379
+ if (host.commands.has(command.name)) {
2380
+ throw new Error(`Command already registered: ${command.name}`);
2381
+ }
2382
+ }
2383
+ }
2384
+ for (const command of commands) {
2385
+ host.commands.register(command, { replace: options2.replace ?? false });
2386
+ }
2387
+ }
2388
+ };
2389
+ }
2390
+
2391
+ // packages/safe-bash/src/commands/sqlite3/index.ts
2392
+ init_platform();
2393
+ import {
2394
+ createSqlite3Command as createRawSqlite3Command,
2395
+ createSqlite3Commands as createRawSqlite3Commands,
2396
+ evalSyncSqlite3
2397
+ } from "../../safe-bash-command-sqlite3/index.js";
2398
+ import { evalSyncSqlite3 as evalSyncSqlite32, settings as settings18 } from "../../safe-bash-command-sqlite3/index.js";
2399
+ function isDefaultSqlite3Options(options2) {
2400
+ if (!options2) return true;
2401
+ return options2.limits === void 0 && options2.engine === void 0;
2402
+ }
2403
+ function createSqlite3Command(options2 = {}) {
2404
+ const def = createRawSqlite3Command(options2);
2405
+ if (isDefaultSqlite3Options(options2)) {
2406
+ builtInDirectContextExecutors.add(def.execute);
2407
+ }
2408
+ return def;
2409
+ }
2410
+ function createSqlite3Commands(options2 = {}) {
2411
+ const defs = createRawSqlite3Commands(options2);
2412
+ if (isDefaultSqlite3Options(options2)) {
2413
+ for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
2414
+ }
2415
+ return defs;
2416
+ }
2417
+ function sqlite3Commands(options2 = {}) {
2418
+ const commands = createSqlite3Commands(options2);
2419
+ return {
2420
+ name: "sqlite3-commands",
2421
+ setup(host) {
2422
+ if (!options2.replace) {
2423
+ for (const command of commands) {
2424
+ if (host.commands.has(command.name)) {
2425
+ throw new Error(`Command already registered: ${command.name}`);
2426
+ }
2427
+ }
2428
+ }
2429
+ for (const command of commands) {
2430
+ host.commands.register(command, { replace: options2.replace ?? false });
2431
+ }
2432
+ }
2433
+ };
2434
+ }
2435
+ syncCommandEvaluators.evalSyncSqlite3 = evalSyncSqlite3;
2436
+
2003
2437
  // packages/safe-bash/src/plugins/composition.ts
2004
2438
  init_platform();
2005
2439
 
@@ -2031,56 +2465,56 @@ function parseTailFollow(arguments_) {
2031
2465
  };
2032
2466
  let ended = false;
2033
2467
  for (let index = 0; index < arguments_.length; index++) {
2034
- const argument2 = arguments_[index];
2035
- if (ended || argument2 === "-" || !argument2.startsWith("-")) {
2036
- args.push(argument2);
2468
+ const argument = arguments_[index];
2469
+ if (ended || argument === "-" || !argument.startsWith("-")) {
2470
+ args.push(argument);
2037
2471
  continue;
2038
2472
  }
2039
- if (argument2 === "--") {
2473
+ if (argument === "--") {
2040
2474
  ended = true;
2041
- args.push(argument2);
2475
+ args.push(argument);
2042
2476
  continue;
2043
2477
  }
2044
- if (argument2 === "--follow" || argument2.startsWith("--follow=")) {
2045
- const method = argument2 === "--follow" ? "descriptor" : argument2.slice(9);
2478
+ if (argument === "--follow" || argument.startsWith("--follow=")) {
2479
+ const method = argument === "--follow" ? "descriptor" : argument.slice(9);
2046
2480
  if (method !== "descriptor" && method !== "name") throw new UsageError(`invalid argument '${method}' for 'follow'`);
2047
2481
  mode = method === "name" ? "F" : "f";
2048
2482
  if (method === "descriptor") retry = explicitRetry;
2049
- } else if (argument2 === "--retry") {
2483
+ } else if (argument === "--retry") {
2050
2484
  retry = true;
2051
2485
  explicitRetry = true;
2052
- } else if (argument2 === "--sleep-interval" || argument2.startsWith("--sleep-interval=")) {
2053
- sleepMs = sleep(argument2 === "--sleep-interval" ? arguments_[++index] : argument2.slice(17));
2054
- } else if (argument2 === "--max-unchanged-stats" || argument2.startsWith("--max-unchanged-stats=")) {
2055
- const text = argument2 === "--max-unchanged-stats" ? arguments_[++index] : argument2.slice(22);
2486
+ } else if (argument === "--sleep-interval" || argument.startsWith("--sleep-interval=")) {
2487
+ sleepMs = sleep(argument === "--sleep-interval" ? arguments_[++index] : argument.slice(17));
2488
+ } else if (argument === "--max-unchanged-stats" || argument.startsWith("--max-unchanged-stats=")) {
2489
+ const text = argument === "--max-unchanged-stats" ? arguments_[++index] : argument.slice(22);
2056
2490
  if (!text || [...text].some((digit) => digit < "0" || digit > "9") || !Number.isSafeInteger(Number(text))) throw new UsageError(`invalid maximum number of unchanged stats: '${text ?? ""}'`);
2057
2491
  maxUnchangedStats = Number(text);
2058
- } else if (argument2 === "--max-idle" || argument2.startsWith("--max-idle=")) {
2059
- const text = argument2 === "--max-idle" ? arguments_[++index] : argument2.slice(11);
2492
+ } else if (argument === "--max-idle" || argument.startsWith("--max-idle=")) {
2493
+ const text = argument === "--max-idle" ? arguments_[++index] : argument.slice(11);
2060
2494
  if (text === void 0 || !/^(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)$/u.test(text)) throw new UsageError("max-idle must be nonnegative decimal seconds");
2061
2495
  const [whole = "", fraction = ""] = text.split(".");
2062
2496
  if (fraction.slice(3).split("").some((digit) => digit !== "0")) throw new UsageError("max-idle must resolve to integer milliseconds");
2063
2497
  const milliseconds = BigInt(whole || "0") * 1000n + BigInt(fraction.slice(0, 3).padEnd(3, "0"));
2064
2498
  if (milliseconds > BigInt(Number.MAX_SAFE_INTEGER)) throw new UsageError("max-idle exceeds safe milliseconds");
2065
2499
  idleMs = Number(milliseconds);
2066
- } else if (argument2.startsWith("--")) {
2067
- args.push(argument2);
2068
- if ((argument2 === "--lines" || argument2 === "--bytes") && index + 1 < arguments_.length) args.push(arguments_[++index]);
2500
+ } else if (argument.startsWith("--")) {
2501
+ args.push(argument);
2502
+ if ((argument === "--lines" || argument === "--bytes") && index + 1 < arguments_.length) args.push(arguments_[++index]);
2069
2503
  } else {
2070
2504
  let kept = "-";
2071
- for (let offset = 1; offset < argument2.length; offset++) {
2072
- const flag = argument2[offset];
2505
+ for (let offset = 1; offset < argument.length; offset++) {
2506
+ const flag = argument[offset];
2073
2507
  if (flag === "f" || flag === "F") {
2074
2508
  mode = flag;
2075
2509
  retry = flag === "F" || explicitRetry;
2076
2510
  } else if (flag === "s") {
2077
- sleepMs = sleep(offset + 1 === argument2.length ? arguments_[++index] : argument2.slice(offset + 1));
2511
+ sleepMs = sleep(offset + 1 === argument.length ? arguments_[++index] : argument.slice(offset + 1));
2078
2512
  break;
2079
2513
  } else {
2080
2514
  kept += flag;
2081
2515
  if (flag === "n" || flag === "c") {
2082
- kept += argument2.slice(offset + 1);
2083
- if (offset + 1 === argument2.length && index + 1 < arguments_.length) {
2516
+ kept += argument.slice(offset + 1);
2517
+ if (offset + 1 === argument.length && index + 1 < arguments_.length) {
2084
2518
  args.push(kept, arguments_[++index]);
2085
2519
  kept = "-";
2086
2520
  }
@@ -2487,9 +2921,6 @@ function isSyncResolved(promise) {
2487
2921
  return Boolean(promise && typeof promise === "object" && promise[syncResolved]);
2488
2922
  }
2489
2923
  var sharedTrOutBuffer = new Uint8Array(64 * 1024);
2490
- var cachedTrOutBuffer = new Uint8Array(32768);
2491
- var lastTrInBuf;
2492
- var lastTrMapping;
2493
2924
  var sharedTrOutInUse = false;
2494
2925
  var trConfigCache = /* @__PURE__ */ new Map();
2495
2926
  var lastTrArg0;
@@ -2885,14 +3316,14 @@ async function suffix(context, source, count, bytes, omit, delimiter) {
2885
3316
  const needed = line.bytes.length + (line.terminated ? 1 : 0);
2886
3317
  if (needed > batch.length) {
2887
3318
  if (batchUsed > 0) {
2888
- await output(context, batch.subarray(0, batchUsed));
3319
+ await outputRange(context, batch, batchUsed);
2889
3320
  batchUsed = 0;
2890
3321
  }
2891
3322
  await output(context, line.terminated ? concatenate([line.bytes, delimiterByte]) : line.bytes);
2892
3323
  continue;
2893
3324
  }
2894
3325
  if (batchUsed + needed > batch.length) {
2895
- await output(context, batch.subarray(0, batchUsed));
3326
+ await outputRange(context, batch, batchUsed);
2896
3327
  batchUsed = 0;
2897
3328
  }
2898
3329
  batch.set(line.bytes, batchUsed);
@@ -2900,7 +3331,7 @@ async function suffix(context, source, count, bytes, omit, delimiter) {
2900
3331
  if (line.terminated) batch[batchUsed++] = delimiter;
2901
3332
  }
2902
3333
  if (batchUsed > 0) {
2903
- await output(context, batch.subarray(0, batchUsed));
3334
+ await outputRange(context, batch, batchUsed);
2904
3335
  }
2905
3336
  }
2906
3337
  return;
@@ -2990,12 +3421,12 @@ function headTailArguments(name, arguments_) {
2990
3421
  const args = [];
2991
3422
  let ended = false;
2992
3423
  for (let index = 0; index < arguments_.length; index++) {
2993
- const argument2 = arguments_[index];
2994
- if (argument2 === "--") ended = true;
3424
+ const argument = arguments_[index];
3425
+ if (argument === "--") ended = true;
2995
3426
  let offset = 1;
2996
- while (offset < argument2.length && argument2[offset] >= "0" && argument2[offset] <= "9") offset++;
2997
- if (!ended && (argument2[0] === "-" || name === "tail" && index === 0 && argument2[0] === "+") && offset > 1) {
2998
- const remainder = argument2.slice(offset);
3427
+ while (offset < argument.length && argument[offset] >= "0" && argument[offset] <= "9") offset++;
3428
+ if (!ended && (argument[0] === "-" || name === "tail" && index === 0 && argument[0] === "+") && offset > 1) {
3429
+ const remainder = argument.slice(offset);
2999
3430
  let unitFlag = "-n";
3000
3431
  let unitSuffix = "";
3001
3432
  let rest = remainder;
@@ -3020,13 +3451,13 @@ function headTailArguments(name, arguments_) {
3020
3451
  }
3021
3452
  const allowedFlags = name === "tail" ? "qvzfF" : "qvz";
3022
3453
  if (Array.from(rest).every((ch) => allowedFlags.includes(ch))) {
3023
- args.push(unitFlag, `${argument2[0] === "+" ? "+" : ""}${argument2.slice(1, offset)}${unitSuffix}`);
3454
+ args.push(unitFlag, `${argument[0] === "+" ? "+" : ""}${argument.slice(1, offset)}${unitSuffix}`);
3024
3455
  for (const ch of rest) args.push(`-${ch}`);
3025
3456
  continue;
3026
3457
  }
3027
3458
  }
3028
- args.push(argument2);
3029
- if (!ended && (["--lines", "--bytes", "--max-idle", "--sleep-interval", "--max-unchanged-stats"].includes(argument2) || argument2.startsWith("-") && !argument2.startsWith("--") && (argument2.endsWith("n") || argument2.endsWith("c") || argument2.endsWith("s")))) {
3459
+ args.push(argument);
3460
+ if (!ended && (["--lines", "--bytes", "--max-idle", "--sleep-interval", "--max-unchanged-stats"].includes(argument) || argument.startsWith("-") && !argument.startsWith("--") && (argument.endsWith("n") || argument.endsWith("c") || argument.endsWith("s")))) {
3030
3461
  if (arguments_[index + 1] !== void 0) args.push(arguments_[++index]);
3031
3462
  }
3032
3463
  }
@@ -3301,12 +3732,12 @@ function streamCommands(maxTeeTargets = Infinity, maxTailFollowHandles = Infinit
3301
3732
  define("tee", async (context) => {
3302
3733
  const args = [];
3303
3734
  let ended = false;
3304
- for (const argument2 of context.args) {
3305
- if (argument2 === "--") ended = true;
3306
- if (!ended && argument2 === "--output-error") args.push("--output-error=warn-nopipe");
3307
- else if (!ended && argument2.startsWith("-") && !argument2.startsWith("--") && argument2.includes("p")) {
3308
- for (const flag of argument2.slice(1)) args.push(flag === "p" ? "--output-error=warn-nopipe" : `-${flag}`);
3309
- } else args.push(argument2);
3735
+ for (const argument of context.args) {
3736
+ if (argument === "--") ended = true;
3737
+ if (!ended && argument === "--output-error") args.push("--output-error=warn-nopipe");
3738
+ else if (!ended && argument.startsWith("-") && !argument.startsWith("--") && argument.includes("p")) {
3739
+ for (const flag of argument.slice(1)) args.push(flag === "p" ? "--output-error=warn-nopipe" : `-${flag}`);
3740
+ } else args.push(argument);
3310
3741
  }
3311
3742
  const parsed = options(args, "ai", { append: "a", "ignore-interrupts": "i", "output-error": "output-error:" });
3312
3743
  const errorMode = value(parsed, "output-error");
@@ -3397,20 +3828,7 @@ function streamCommands(maxTeeTargets = Infinity, maxTailFollowHandles = Infinit
3397
3828
  const useShared = chunk.length <= sharedTrOutBuffer.length;
3398
3829
  const buf = useShared ? sharedTrOutBuffer : new Uint8Array(chunk.length);
3399
3830
  if (!deleting && !squeezing) {
3400
- if (useShared && chunk.length >= 256 && lastTrInBuf !== void 0 && chunk.length === lastTrInBuf.byteLength && mapping === lastTrMapping && equalBytes(lastTrInBuf, chunk)) {
3401
- const p2 = outputRange(context, cachedTrOutBuffer, chunk.length);
3402
- if (!isSyncResolved(p2)) {
3403
- released = true;
3404
- return executeTrAfterPending(p2, context, iter, deleting, squeezing, mapping, removed, squeezed, previous, true);
3405
- }
3406
- continue;
3407
- }
3408
3831
  for (let index = 0; index < chunk.length; index++) buf[index] = mapping[chunk[index]];
3409
- if (useShared && chunk.length >= 256 && chunk.length <= 32768) {
3410
- lastTrInBuf = encodeBytes(chunk);
3411
- lastTrMapping = mapping;
3412
- cachedTrOutBuffer.set(buf.subarray(0, chunk.length));
3413
- }
3414
3832
  const p = useShared ? outputRange(context, buf, chunk.length) : output(context, buf);
3415
3833
  if (!isSyncResolved(p)) {
3416
3834
  released = true;
@@ -3439,12 +3857,15 @@ function streamCommands(maxTeeTargets = Infinity, maxTailFollowHandles = Infinit
3439
3857
  released = true;
3440
3858
  return rejectTrOutput(iter, err);
3441
3859
  } finally {
3442
- if (!released) sharedTrOutInUse = false;
3860
+ if (!released) {
3861
+ sharedTrOutBuffer.fill(0);
3862
+ sharedTrOutInUse = false;
3863
+ }
3443
3864
  }
3444
3865
  }
3445
3866
  return executeTrAsync(context, iter, deleting, squeezing, mapping, removed, squeezed, previous, false);
3446
3867
  })
3447
- ].map((command2) => ({ ...command2, filesystemRequirements: streamRequirements[command2.name] }));
3868
+ ].map((command) => ({ ...command, filesystemRequirements: streamRequirements[command.name] }));
3448
3869
  }
3449
3870
  async function executeTrAsync(context, iter, deleting, squeezing, mapping, removed, squeezingTable, initialPrevious, alreadyOwnsShared) {
3450
3871
  const squeezed = squeezingTable;
@@ -3468,7 +3889,7 @@ async function executeTrAsync(context, iter, deleting, squeezing, mapping, remov
3468
3889
  const buf = useShared ? sharedTrOutBuffer : new Uint8Array(chunk.length);
3469
3890
  if (!deleting && !squeezing) {
3470
3891
  for (let index = 0; index < chunk.length; index++) buf[index] = mapping[chunk[index]];
3471
- const p = output(context, useShared ? buf.subarray(0, chunk.length) : buf);
3892
+ const p = useShared ? outputRange(context, buf, chunk.length) : output(context, buf);
3472
3893
  if (!isSyncResolved(p)) await p;
3473
3894
  continue;
3474
3895
  }
@@ -3482,7 +3903,7 @@ async function executeTrAsync(context, iter, deleting, squeezing, mapping, remov
3482
3903
  previous = translated;
3483
3904
  }
3484
3905
  if (count) {
3485
- const p = output(context, buf.subarray(0, count));
3906
+ const p = outputRange(context, buf, count);
3486
3907
  if (!isSyncResolved(p)) await p;
3487
3908
  }
3488
3909
  }
@@ -3490,7 +3911,10 @@ async function executeTrAsync(context, iter, deleting, squeezing, mapping, remov
3490
3911
  if (ownsShared) sharedTrOutBuffer = new Uint8Array(sharedTrOutBuffer.length);
3491
3912
  throw error;
3492
3913
  } finally {
3493
- if (ownsShared) sharedTrOutInUse = false;
3914
+ if (ownsShared) {
3915
+ sharedTrOutBuffer.fill(0);
3916
+ sharedTrOutInUse = false;
3917
+ }
3494
3918
  if (!done) {
3495
3919
  if (typeof iter.syncReturn === "function") iter.syncReturn();
3496
3920
  else await iter.return?.();
@@ -3968,7 +4392,7 @@ var SortWork = class {
3968
4392
  }
3969
4393
  }
3970
4394
  };
3971
- async function sortRecords(records, compare2, work) {
4395
+ async function sortRecords(records, compare, work) {
3972
4396
  if (records.length < 2) return records;
3973
4397
  let source = records;
3974
4398
  let target = new Array(records.length);
@@ -3986,7 +4410,7 @@ async function sortRecords(records, compare2, work) {
3986
4410
  target[index] = source[left++];
3987
4411
  continue;
3988
4412
  }
3989
- const compared = compare2(source[left], source[right]);
4413
+ const compared = compare(source[left], source[right]);
3990
4414
  const order = typeof compared === "number" ? compared : await compared;
3991
4415
  if (order <= 0) {
3992
4416
  target[index] = source[left++];
@@ -4054,9 +4478,6 @@ async function cutRanges(list, work) {
4054
4478
  }
4055
4479
  return normalized;
4056
4480
  }
4057
- var sharedCutOutBuffer = new Uint8Array(64 * 1024);
4058
- var sharedCutOutInUse = false;
4059
- var sharedUniqOutBuffer = new Uint8Array(128 * 1024);
4060
4481
  function writeUniqCountBytes(writeByte, count) {
4061
4482
  const digits = String(count);
4062
4483
  const pad = 7 - digits.length;
@@ -4068,19 +4489,11 @@ var CutOutput = class {
4068
4489
  constructor(context, work) {
4069
4490
  this.context = context;
4070
4491
  this.work = work;
4071
- if (!sharedCutOutInUse) {
4072
- sharedCutOutInUse = true;
4073
- this.#buffer = sharedCutOutBuffer;
4074
- this.#ownsShared = true;
4075
- } else {
4076
- this.#buffer = new Uint8Array(64 * 1024);
4077
- this.#ownsShared = false;
4078
- }
4492
+ this.#buffer = new Uint8Array(64 * 1024);
4079
4493
  }
4080
4494
  context;
4081
4495
  work;
4082
4496
  #buffer;
4083
- #ownsShared;
4084
4497
  #used = 0;
4085
4498
  get remaining() {
4086
4499
  return this.#buffer.length - this.#used;
@@ -4149,9 +4562,6 @@ var CutOutput = class {
4149
4562
  this.#used = 0;
4150
4563
  await output(this.context, bytes);
4151
4564
  }
4152
- release() {
4153
- if (this.#ownsShared) sharedCutOutInUse = false;
4154
- }
4155
4565
  };
4156
4566
  function cutFieldBoundary(record, separator, start, work) {
4157
4567
  if (record.length - start <= 4096) {
@@ -4516,7 +4926,7 @@ async function compareVersions(left, right, work) {
4516
4926
  if (result) return result;
4517
4927
  return await compareVersionParts(await versionPrefix(left, work), await versionPrefix(right, work), work) || await compareVersionParts(left, right, work);
4518
4928
  }
4519
- async function mergeSortRuns(runs, compare2, work) {
4929
+ async function mergeSortRuns(runs, compare, work) {
4520
4930
  while (runs.length > 1) {
4521
4931
  const next = [];
4522
4932
  for (let index = 0; index < runs.length; index += 2) {
@@ -4531,7 +4941,7 @@ async function mergeSortRuns(runs, compare2, work) {
4531
4941
  merged.push(left[first++]);
4532
4942
  continue;
4533
4943
  }
4534
- const compared = compare2(left[first], right[second]);
4944
+ const compared = compare(left[first], right[second]);
4535
4945
  const order = typeof compared === "number" ? compared : await compared;
4536
4946
  if (order <= 0) {
4537
4947
  merged.push(left[first++]);
@@ -4617,14 +5027,6 @@ var sharedSortIndices = new Int32Array(4096);
4617
5027
  var sharedSortScratchIndices = new Int32Array(4096);
4618
5028
  var sharedSortInScratch = new Uint8Array(65536);
4619
5029
  var sharedSortInUse = false;
4620
- var sharedSortOutScratch = new Uint8Array(65536);
4621
- var lastSort;
4622
- var cachedCutOutBuffer = new Uint8Array(32768);
4623
- var lastCutInBuf;
4624
- var lastCutSep = -1;
4625
- var lastCutField = -1;
4626
- var lastCutMaxLineLen = 0;
4627
- var lastCutOutUsed = -1;
4628
5030
  var SORT_LONG_OPTIONS = Object.freeze({
4629
5031
  "human-numeric-sort": "h",
4630
5032
  "numeric-sort": "n",
@@ -4932,13 +5334,13 @@ async function executeSortGeneral(context, preReadChunks) {
4932
5334
  break;
4933
5335
  }
4934
5336
  }
4935
- const args = hasCheckLong ? context.args.map((argument2) => {
4936
- if (ended) return argument2;
4937
- if (argument2 === "--") ended = true;
4938
- if (argument2 === "--check" || argument2 === "--check=diagnose-first") return "-c";
4939
- if (argument2 === "--check=quiet" || argument2 === "--check=silent") return "-C";
4940
- if (argument2.startsWith("--check=")) throw new UsageError(`invalid argument '${argument2.slice(8)}' for '--check'`);
4941
- return argument2;
5337
+ const args = hasCheckLong ? context.args.map((argument) => {
5338
+ if (ended) return argument;
5339
+ if (argument === "--") ended = true;
5340
+ if (argument === "--check" || argument === "--check=diagnose-first") return "-c";
5341
+ if (argument === "--check=quiet" || argument === "--check=silent") return "-C";
5342
+ if (argument.startsWith("--check=")) throw new UsageError(`invalid argument '${argument.slice(8)}' for '--check'`);
5343
+ return argument;
4942
5344
  }) : context.args;
4943
5345
  const parsed = options(args, "hngMVdimrfbuszt:k:o:cCS:", SORT_LONG_OPTIONS, false, void 0, (key, index) => {
4944
5346
  if (key === "S" && !args[index].startsWith("--sort=") && args[index - 1] !== "--sort") throw new UsageError("invalid option -- 'S'");
@@ -5412,7 +5814,7 @@ async function executeSortGeneral(context, preReadChunks) {
5412
5814
  if (resolved !== 0 || skipTieFallback) return resolved;
5413
5815
  return await compareSortBytes(left, right, work) * direction;
5414
5816
  };
5415
- const compare2 = (left, right) => {
5817
+ const compare = (left, right) => {
5416
5818
  const result = keyCompare(left, right);
5417
5819
  if (typeof result === "number") {
5418
5820
  if (result !== 0 || skipTieFallback) return result;
@@ -5424,7 +5826,7 @@ async function executeSortGeneral(context, preReadChunks) {
5424
5826
  const records = [];
5425
5827
  const runs = [];
5426
5828
  const checkRecordAsync = async (bytes) => {
5427
- if (records.length && (await compare2(records.at(-1), bytes) > 0 || parsed.flags.has("u") && await keyCompare(records.at(-1), bytes) === 0)) {
5829
+ if (records.length && (await compare(records.at(-1), bytes) > 0 || parsed.flags.has("u") && await keyCompare(records.at(-1), bytes) === 0)) {
5428
5830
  if (!parsed.flags.has("C")) await diagnostic(context, new PublicDiagnostic(`disorder at record ${records.length + 1}`));
5429
5831
  return false;
5430
5832
  }
@@ -5450,121 +5852,7 @@ async function executeSortGeneral(context, preReadChunks) {
5450
5852
  }
5451
5853
  }
5452
5854
  if (checking) return { exitCode };
5453
- let ordered;
5454
- if (!parsed.flags.has("m") && !parsed.flags.has("u") && records.length >= 2 && records.length <= 65536 && (canMultiKeyFast || isSingleLexKeyFast)) {
5455
- const count = records.length;
5456
- const keySpecs = keys.map((k) => {
5457
- const f = k.flags.size ? k.flags : parsed.flags;
5458
- const numeric = f.has("n") || f.has("h");
5459
- const human = f.has("h");
5460
- const blanks = f.has("b");
5461
- const revScale = f.has("r") ? -1 : 1;
5462
- if (numeric) {
5463
- const fastNums = new Float64Array(count);
5464
- const numVals = new Array(count);
5465
- return { numeric: true, human, blanks, revScale, key: k, fastNums, numVals };
5466
- }
5467
- const slices = new Array(count);
5468
- return { numeric: false, blanks, revScale, key: k, slices };
5469
- });
5470
- for (let i = 0; i < count; i++) {
5471
- const rec = records[i];
5472
- for (let ki = 0; ki < keySpecs.length; ki++) {
5473
- const ks = keySpecs[ki];
5474
- const sliceOrPromise = keyBytesSync(rec, ks.key, separator, ks.blanks, work);
5475
- const slice = sliceOrPromise instanceof Promise ? await sliceOrPromise : sliceOrPromise;
5476
- if (ks.numeric) {
5477
- const parsedOrPromise = parseNumeric(slice, work, ks.human);
5478
- const nv = parsedOrPromise instanceof Promise ? await parsedOrPromise : parsedOrPromise;
5479
- ks.numVals[i] = nv;
5480
- if (!ks.human && nv.fraction.length === 0 && nv.whole.length <= 15) {
5481
- const mag = nv.whole.length === 0 ? 0 : Number(nv.whole);
5482
- ks.fastNums[i] = nv.negative ? mag === 0 ? 0 : -mag : mag;
5483
- } else {
5484
- ks.fastNums[i] = Number.NaN;
5485
- }
5486
- } else {
5487
- ks.slices[i] = slice;
5488
- }
5489
- }
5490
- }
5491
- let srcIdx = new Int32Array(count);
5492
- let dstIdx = new Int32Array(count);
5493
- for (let i = 0; i < count; i++) srcIdx[i] = i;
5494
- for (let width = 1; width < count; width *= 2) {
5495
- for (let begin = 0; begin < count; begin += width * 2) {
5496
- const middle = Math.min(begin + width, count);
5497
- const end = Math.min(begin + width * 2, count);
5498
- let left = begin;
5499
- let right = middle;
5500
- for (let index = begin; index < end; index++) {
5501
- const cp = work.charge(2);
5502
- if (cp) await cp;
5503
- if (left < middle) {
5504
- if (right === end) {
5505
- dstIdx[index] = srcIdx[left++];
5506
- continue;
5507
- }
5508
- const a = srcIdx[left];
5509
- const b = srcIdx[right];
5510
- let cmp = 0;
5511
- for (let ki = 0; ki < keySpecs.length; ki++) {
5512
- const ks = keySpecs[ki];
5513
- if (ks.numeric) {
5514
- const fa = ks.fastNums[a];
5515
- const fb = ks.fastNums[b];
5516
- if (fa === fa && fb === fb) {
5517
- cmp = fa === fb ? 0 : fa < fb ? -ks.revScale : ks.revScale;
5518
- } else {
5519
- const r = compareNumericValues(ks.numVals[a], ks.numVals[b], work);
5520
- const resolved = typeof r === "number" ? r : await r;
5521
- cmp = resolved * ks.revScale;
5522
- }
5523
- } else {
5524
- const sa = ks.slices[a];
5525
- const sb = ks.slices[b];
5526
- const lenA = sa.length;
5527
- const lenB = sb.length;
5528
- const minL = lenA < lenB ? lenA : lenB;
5529
- let d = 0;
5530
- for (let p = 0; p < minL; p++) {
5531
- d = sa[p] - sb[p];
5532
- if (d !== 0) break;
5533
- }
5534
- if (d === 0) d = lenA - lenB;
5535
- cmp = d * ks.revScale;
5536
- }
5537
- if (cmp !== 0) break;
5538
- }
5539
- if (cmp === 0 && !skipTieFallback) {
5540
- const ra = records[a];
5541
- const rb = records[b];
5542
- const minL = ra.length < rb.length ? ra.length : rb.length;
5543
- let d = 0;
5544
- for (let p = 0; p < minL; p++) {
5545
- d = ra[p] - rb[p];
5546
- if (d !== 0) break;
5547
- }
5548
- if (d === 0) d = ra.length - rb.length;
5549
- cmp = d * direction;
5550
- }
5551
- if (cmp <= 0) {
5552
- dstIdx[index] = srcIdx[left++];
5553
- continue;
5554
- }
5555
- }
5556
- dstIdx[index] = srcIdx[right++];
5557
- }
5558
- }
5559
- const tmp = srcIdx;
5560
- srcIdx = dstIdx;
5561
- dstIdx = tmp;
5562
- }
5563
- ordered = new Array(count);
5564
- for (let i = 0; i < count; i++) ordered[i] = records[srcIdx[i]];
5565
- } else {
5566
- ordered = parsed.flags.has("m") ? await mergeSortRuns(runs, compare2, work) : await sortRecords(records, compare2, work);
5567
- }
5855
+ const ordered = parsed.flags.has("m") ? await mergeSortRuns(runs, compare, work) : await sortRecords(records, compare, work);
5568
5856
  let estBytes = 0;
5569
5857
  let allCounted = true;
5570
5858
  for (let i = 0; i < ordered.length; i++) {
@@ -5652,267 +5940,263 @@ async function executeCutGeneral(context) {
5652
5940
  const outputDelimiterBytes = outputDelimiter === void 0 ? separator : outputDelimiter.length === 0 ? Uint8Array.of(0) : encoder.encode(outputDelimiter);
5653
5941
  const writer = new CutOutput(context, work);
5654
5942
  let exitCode = 0;
5655
- try {
5656
- for (const name of parsed.operands.length ? parsed.operands : ["-"]) {
5943
+ for (const name of parsed.operands.length ? parsed.operands : ["-"]) {
5944
+ try {
5657
5945
  try {
5658
- try {
5659
- const onlyDelimited = parsed.flags.has("s");
5660
- const fastSingleByteField = mode === "f" && separator.length === 1;
5661
- const sepByte = separator[0];
5662
- const outDelimLen = outputDelimiterBytes.length;
5663
- const processFastFieldRangeSlow = async (buf, lineStart, lineEnd) => {
5664
- context.signal.throwIfAborted();
5665
- let boundary = buf.indexOf(sepByte, lineStart);
5666
- if (boundary >= lineEnd) boundary = -1;
5667
- const c0 = work.charge(boundary < 0 ? lineEnd - lineStart : boundary - lineStart + 1);
5668
- if (c0) await c0;
5946
+ const onlyDelimited = parsed.flags.has("s");
5947
+ const fastSingleByteField = mode === "f" && separator.length === 1;
5948
+ const sepByte = separator[0];
5949
+ const outDelimLen = outputDelimiterBytes.length;
5950
+ const processFastFieldRangeSlow = async (buf, lineStart, lineEnd) => {
5951
+ context.signal.throwIfAborted();
5952
+ let boundary = buf.indexOf(sepByte, lineStart);
5953
+ if (boundary >= lineEnd) boundary = -1;
5954
+ const c0 = work.charge(boundary < 0 ? lineEnd - lineStart : boundary - lineStart + 1);
5955
+ if (c0) await c0;
5956
+ if (boundary < 0) {
5957
+ if (onlyDelimited) return;
5958
+ const w = writer.writeRange(buf, lineStart, lineEnd);
5959
+ if (w) await w;
5960
+ } else {
5961
+ let cursor = 0;
5962
+ let field = 1;
5963
+ let start = lineStart;
5964
+ let emitted = false;
5965
+ while (true) {
5966
+ const cp = work.charge();
5967
+ if (cp) await cp;
5968
+ while (cursor < ranges.length && field > ranges[cursor].end) cursor++;
5969
+ const included = cursor < ranges.length && field >= ranges[cursor].start;
5970
+ if (included !== complement) {
5971
+ if (emitted) {
5972
+ const w1 = writer.write(outputDelimiterBytes);
5973
+ if (w1) await w1;
5974
+ }
5975
+ const w2 = writer.writeRange(buf, start, boundary < 0 ? lineEnd : boundary);
5976
+ if (w2) await w2;
5977
+ emitted = true;
5978
+ }
5979
+ field++;
5980
+ if (boundary < 0 || !complement && cursor >= ranges.length) break;
5981
+ start = boundary + 1;
5982
+ boundary = start <= lineEnd ? buf.indexOf(sepByte, start) : -1;
5983
+ if (boundary >= lineEnd) boundary = -1;
5984
+ const cn = work.charge(boundary < 0 ? lineEnd - start : boundary - start + 1);
5985
+ if (cn) await cn;
5986
+ }
5987
+ }
5988
+ const wd = writer.writeByte(recordDelimiter);
5989
+ if (wd) await wd;
5990
+ };
5991
+ const processFastFieldRange = (buf, lineStart, lineEnd) => {
5992
+ const lineLen = lineEnd - lineStart;
5993
+ if (writer.remaining <= lineLen * (outDelimLen > 1 ? outDelimLen : 1) + 1) {
5994
+ return processFastFieldRangeSlow(buf, lineStart, lineEnd);
5995
+ }
5996
+ context.signal.throwIfAborted();
5997
+ let boundary = buf.indexOf(sepByte, lineStart);
5998
+ if (boundary >= lineEnd) boundary = -1;
5999
+ let totalCharge = boundary < 0 ? lineLen : boundary - lineStart + 1;
6000
+ if (boundary < 0) {
6001
+ if (onlyDelimited) return work.charge(totalCharge);
6002
+ totalCharge += writer.writeRangeUncharged(buf, lineStart, lineEnd);
6003
+ } else {
6004
+ let cursor = 0;
6005
+ let field = 1;
6006
+ let start = lineStart;
6007
+ let emitted = false;
6008
+ while (true) {
6009
+ totalCharge += 1;
6010
+ while (cursor < ranges.length && field > ranges[cursor].end) cursor++;
6011
+ const included = cursor < ranges.length && field >= ranges[cursor].start;
6012
+ if (included !== complement) {
6013
+ if (emitted) {
6014
+ totalCharge += writer.writeRangeUncharged(outputDelimiterBytes, 0, outDelimLen);
6015
+ }
6016
+ totalCharge += writer.writeRangeUncharged(buf, start, boundary < 0 ? lineEnd : boundary);
6017
+ emitted = true;
6018
+ }
6019
+ field++;
6020
+ if (boundary < 0 || !complement && cursor >= ranges.length) break;
6021
+ start = boundary + 1;
6022
+ boundary = start <= lineEnd ? buf.indexOf(sepByte, start) : -1;
6023
+ if (boundary >= lineEnd) boundary = -1;
6024
+ totalCharge += boundary < 0 ? lineEnd - start : boundary - start + 1;
6025
+ }
6026
+ }
6027
+ writer.writeByteUncharged(recordDelimiter);
6028
+ totalCharge += 1;
6029
+ return work.charge(totalCharge);
6030
+ };
6031
+ const sharedUtf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
6032
+ const canFastSliceCut = (byteSelection || mode === "c") && !complement && ranges.length <= 16;
6033
+ const processFastSliceRange = (buf, lineStart, lineEnd) => {
6034
+ const lineLen = lineEnd - lineStart;
6035
+ if (writer.remaining <= lineLen + (outputDelimiter !== void 0 ? Math.max(0, ranges.length - 1) * outDelimLen : 0) + 1) {
6036
+ return null;
6037
+ }
6038
+ if (!byteSelection) {
6039
+ for (let i = lineStart; i < lineEnd; i++) {
6040
+ if (buf[i] >= 128) return null;
6041
+ }
6042
+ }
6043
+ context.signal.throwIfAborted();
6044
+ let totalCharge = lineLen + 1;
6045
+ let emitted = false;
6046
+ for (let rIdx = 0; rIdx < ranges.length; rIdx++) {
6047
+ const r = ranges[rIdx];
6048
+ const s = lineStart + r.start - 1;
6049
+ if (s >= lineEnd) break;
6050
+ const e = Math.min(lineEnd, lineStart + r.end);
6051
+ if (e > s) {
6052
+ if (emitted && outputDelimiter !== void 0) {
6053
+ totalCharge += writer.writeRangeUncharged(outputDelimiterBytes, 0, outDelimLen);
6054
+ }
6055
+ totalCharge += writer.writeRangeUncharged(buf, s, e);
6056
+ emitted = true;
6057
+ }
6058
+ }
6059
+ writer.writeByteUncharged(recordDelimiter);
6060
+ return work.charge(totalCharge);
6061
+ };
6062
+ const processLineBytes = async (lineBytes) => {
6063
+ context.signal.throwIfAborted();
6064
+ let cursor = 0;
6065
+ const selected = (position) => {
6066
+ while (cursor < ranges.length && position > ranges[cursor].end) cursor++;
6067
+ const included = cursor < ranges.length && position >= ranges[cursor].start;
6068
+ return included !== complement ? cursor : -1;
6069
+ };
6070
+ if (mode === "f") {
6071
+ const record = encodeBytes(lineBytes.buffer, lineBytes.byteOffset, lineBytes.byteLength);
6072
+ const b0 = cutFieldBoundary(record, separator, 0, work);
6073
+ let boundary = typeof b0 === "number" ? b0 : await b0;
5669
6074
  if (boundary < 0) {
5670
6075
  if (onlyDelimited) return;
5671
- const w = writer.writeRange(buf, lineStart, lineEnd);
6076
+ const w = writer.write(lineBytes);
5672
6077
  if (w) await w;
5673
6078
  } else {
5674
- let cursor = 0;
5675
6079
  let field = 1;
5676
- let start = lineStart;
6080
+ let start = 0;
5677
6081
  let emitted = false;
5678
6082
  while (true) {
5679
- const cp = work.charge();
5680
- if (cp) await cp;
5681
- while (cursor < ranges.length && field > ranges[cursor].end) cursor++;
5682
- const included = cursor < ranges.length && field >= ranges[cursor].start;
5683
- if (included !== complement) {
6083
+ const checkpoint = work.charge();
6084
+ if (checkpoint) await checkpoint;
6085
+ if (selected(field++) >= 0) {
5684
6086
  if (emitted) {
5685
6087
  const w1 = writer.write(outputDelimiterBytes);
5686
6088
  if (w1) await w1;
5687
6089
  }
5688
- const w2 = writer.writeRange(buf, start, boundary < 0 ? lineEnd : boundary);
6090
+ const w2 = writer.write(record.subarray(start, boundary < 0 ? record.length : boundary));
5689
6091
  if (w2) await w2;
5690
6092
  emitted = true;
5691
6093
  }
5692
- field++;
5693
6094
  if (boundary < 0 || !complement && cursor >= ranges.length) break;
5694
- start = boundary + 1;
5695
- boundary = start <= lineEnd ? buf.indexOf(sepByte, start) : -1;
5696
- if (boundary >= lineEnd) boundary = -1;
5697
- const cn = work.charge(boundary < 0 ? lineEnd - start : boundary - start + 1);
5698
- if (cn) await cn;
6095
+ start = boundary + separator.length;
6096
+ const bn = cutFieldBoundary(record, separator, start, work);
6097
+ boundary = typeof bn === "number" ? bn : await bn;
5699
6098
  }
5700
6099
  }
5701
- const wd = writer.writeByte(recordDelimiter);
5702
- if (wd) await wd;
5703
- };
5704
- const processFastFieldRange = (buf, lineStart, lineEnd) => {
5705
- const lineLen = lineEnd - lineStart;
5706
- if (writer.remaining <= lineLen * (outDelimLen > 1 ? outDelimLen : 1) + 1) {
5707
- return processFastFieldRangeSlow(buf, lineStart, lineEnd);
5708
- }
5709
- context.signal.throwIfAborted();
5710
- let boundary = buf.indexOf(sepByte, lineStart);
5711
- if (boundary >= lineEnd) boundary = -1;
5712
- let totalCharge = boundary < 0 ? lineLen : boundary - lineStart + 1;
5713
- if (boundary < 0) {
5714
- if (onlyDelimited) return work.charge(totalCharge);
5715
- totalCharge += writer.writeRangeUncharged(buf, lineStart, lineEnd);
5716
- } else {
5717
- let cursor = 0;
5718
- let field = 1;
5719
- let start = lineStart;
5720
- let emitted = false;
5721
- while (true) {
5722
- totalCharge += 1;
5723
- while (cursor < ranges.length && field > ranges[cursor].end) cursor++;
5724
- const included = cursor < ranges.length && field >= ranges[cursor].start;
5725
- if (included !== complement) {
5726
- if (emitted) {
5727
- totalCharge += writer.writeRangeUncharged(outputDelimiterBytes, 0, outDelimLen);
5728
- }
5729
- totalCharge += writer.writeRangeUncharged(buf, start, boundary < 0 ? lineEnd : boundary);
6100
+ } else if (byteSelection) {
6101
+ let emitted = false;
6102
+ let previousRange = -1;
6103
+ for (let offset = 0; offset < lineBytes.length; offset += 4096) {
6104
+ const end = Math.min(lineBytes.length, offset + 4096);
6105
+ const checkpoint = work.charge(end - offset);
6106
+ if (checkpoint) await checkpoint;
6107
+ let start = -1;
6108
+ for (let index = offset; index < end; index++) {
6109
+ const range = selected(index + 1);
6110
+ if (range !== previousRange && start >= 0) {
6111
+ await writer.write(lineBytes.subarray(start, index));
6112
+ start = -1;
6113
+ }
6114
+ if (range >= 0 && start < 0) {
6115
+ if (range !== previousRange && emitted && outputDelimiter !== void 0) await writer.write(outputDelimiterBytes);
6116
+ start = index;
5730
6117
  emitted = true;
5731
6118
  }
5732
- field++;
5733
- if (boundary < 0 || !complement && cursor >= ranges.length) break;
5734
- start = boundary + 1;
5735
- boundary = start <= lineEnd ? buf.indexOf(sepByte, start) : -1;
5736
- if (boundary >= lineEnd) boundary = -1;
5737
- totalCharge += boundary < 0 ? lineEnd - start : boundary - start + 1;
5738
- }
5739
- }
5740
- writer.writeByteUncharged(recordDelimiter);
5741
- totalCharge += 1;
5742
- return work.charge(totalCharge);
5743
- };
5744
- const sharedUtf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
5745
- const canFastSliceCut = (byteSelection || mode === "c") && !complement && ranges.length <= 16;
5746
- const processFastSliceRange = (buf, lineStart, lineEnd) => {
5747
- const lineLen = lineEnd - lineStart;
5748
- if (writer.remaining <= lineLen * (outDelimLen > 1 ? outDelimLen : 1) + 1) {
5749
- return null;
5750
- }
5751
- if (!byteSelection) {
5752
- for (let i = lineStart; i < lineEnd; i++) {
5753
- if (buf[i] >= 128) return null;
6119
+ previousRange = range;
5754
6120
  }
6121
+ if (start >= 0) await writer.write(lineBytes.subarray(start, end));
5755
6122
  }
5756
- context.signal.throwIfAborted();
5757
- let totalCharge = lineLen + 1;
6123
+ } else {
6124
+ const decoder2 = sharedUtf8Decoder;
6125
+ let index = 0;
5758
6126
  let emitted = false;
5759
- for (let rIdx = 0; rIdx < ranges.length; rIdx++) {
5760
- const r = ranges[rIdx];
5761
- const s = lineStart + r.start - 1;
5762
- if (s >= lineEnd) break;
5763
- const e = Math.min(lineEnd, lineStart + r.end);
5764
- if (e > s) {
5765
- if (emitted && outputDelimiter !== void 0) {
5766
- totalCharge += writer.writeRangeUncharged(outputDelimiterBytes, 0, outDelimLen);
5767
- }
5768
- totalCharge += writer.writeRangeUncharged(buf, s, e);
5769
- emitted = true;
5770
- }
5771
- }
5772
- writer.writeByteUncharged(recordDelimiter);
5773
- return work.charge(totalCharge);
5774
- };
5775
- const processLineBytes = async (lineBytes) => {
5776
- context.signal.throwIfAborted();
5777
- let cursor = 0;
5778
- const selected = (position) => {
5779
- while (cursor < ranges.length && position > ranges[cursor].end) cursor++;
5780
- const included = cursor < ranges.length && position >= ranges[cursor].start;
5781
- return included !== complement ? cursor : -1;
5782
- };
5783
- if (mode === "f") {
5784
- const record = encodeBytes(lineBytes.buffer, lineBytes.byteOffset, lineBytes.byteLength);
5785
- const b0 = cutFieldBoundary(record, separator, 0, work);
5786
- let boundary = typeof b0 === "number" ? b0 : await b0;
5787
- if (boundary < 0) {
5788
- if (onlyDelimited) return;
5789
- const w = writer.write(lineBytes);
5790
- if (w) await w;
5791
- } else {
5792
- let field = 1;
5793
- let start = 0;
5794
- let emitted = false;
5795
- while (true) {
5796
- const checkpoint = work.charge();
5797
- if (checkpoint) await checkpoint;
5798
- if (selected(field++) >= 0) {
5799
- if (emitted) {
5800
- const w1 = writer.write(outputDelimiterBytes);
5801
- if (w1) await w1;
5802
- }
5803
- const w2 = writer.write(record.subarray(start, boundary < 0 ? record.length : boundary));
5804
- if (w2) await w2;
5805
- emitted = true;
5806
- }
5807
- if (boundary < 0 || !complement && cursor >= ranges.length) break;
5808
- start = boundary + separator.length;
5809
- const bn = cutFieldBoundary(record, separator, start, work);
5810
- boundary = typeof bn === "number" ? bn : await bn;
5811
- }
5812
- }
5813
- } else if (byteSelection) {
5814
- let emitted = false;
5815
- let previousRange = -1;
5816
- for (let offset = 0; offset < lineBytes.length; offset += 4096) {
5817
- const end = Math.min(lineBytes.length, offset + 4096);
5818
- const checkpoint = work.charge(end - offset);
5819
- if (checkpoint) await checkpoint;
5820
- let start = -1;
5821
- for (let index = offset; index < end; index++) {
5822
- const range = selected(index + 1);
5823
- if (range !== previousRange && start >= 0) {
5824
- await writer.write(lineBytes.subarray(start, index));
5825
- start = -1;
5826
- }
5827
- if (range >= 0 && start < 0) {
5828
- if (range !== previousRange && emitted && outputDelimiter !== void 0) await writer.write(outputDelimiterBytes);
5829
- start = index;
5830
- emitted = true;
5831
- }
5832
- previousRange = range;
5833
- }
5834
- if (start >= 0) await writer.write(lineBytes.subarray(start, end));
5835
- }
5836
- } else {
5837
- const decoder = sharedUtf8Decoder;
5838
- let index = 0;
5839
- let emitted = false;
5840
- let previousRange = -1;
5841
- for (let offset = 0; offset < lineBytes.length; offset += 4096) {
5842
- const end = Math.min(lineBytes.length, offset + 4096);
5843
- const checkpoint = work.charge(end - offset);
5844
- if (checkpoint) await checkpoint;
5845
- const text = decoder.decode(lineBytes.subarray(offset, end), { stream: end < lineBytes.length });
5846
- let start = -1;
5847
- let position = 0;
5848
- for (const character of text) {
5849
- const checkpoint2 = work.charge();
5850
- if (checkpoint2) await checkpoint2;
5851
- const range = selected(++index);
5852
- if (range !== previousRange && start >= 0) {
5853
- await writer.text(text.slice(start, position));
5854
- start = -1;
5855
- }
5856
- if (range >= 0 && start < 0) {
5857
- if (range !== previousRange && emitted && outputDelimiter !== void 0) await writer.write(outputDelimiterBytes);
5858
- start = position;
5859
- emitted = true;
5860
- }
5861
- position += character.length;
5862
- previousRange = range;
6127
+ let previousRange = -1;
6128
+ for (let offset = 0; offset < lineBytes.length; offset += 4096) {
6129
+ const end = Math.min(lineBytes.length, offset + 4096);
6130
+ const checkpoint = work.charge(end - offset);
6131
+ if (checkpoint) await checkpoint;
6132
+ const text = decoder2.decode(lineBytes.subarray(offset, end), { stream: end < lineBytes.length });
6133
+ let start = -1;
6134
+ let position = 0;
6135
+ for (const character of text) {
6136
+ const checkpoint2 = work.charge();
6137
+ if (checkpoint2) await checkpoint2;
6138
+ const range = selected(++index);
6139
+ if (range !== previousRange && start >= 0) {
6140
+ await writer.text(text.slice(start, position));
6141
+ start = -1;
5863
6142
  }
5864
- if (start >= 0) await writer.text(text.slice(start));
5865
- }
5866
- }
5867
- const wd = writer.writeByte(recordDelimiter);
5868
- if (wd) await wd;
5869
- };
5870
- const pending = new RecordBuffer(bufferLimit);
5871
- try {
5872
- for await (const chunk of input(context, name)) {
5873
- let start = 0;
5874
- while (start < chunk.length) {
5875
- const offset = chunk.indexOf(recordDelimiter, start);
5876
- if (offset < 0) break;
5877
- if (fastSingleByteField && pending.size === 0 && offset - start <= 4096) {
5878
- const p = processFastFieldRange(chunk, start, offset);
5879
- if (p) await p;
5880
- } else if (canFastSliceCut && pending.size === 0 && offset - start <= 4096) {
5881
- const p = processFastSliceRange(chunk, start, offset);
5882
- if (p === null) {
5883
- await processLineBytes(chunk.subarray(start, offset));
5884
- } else if (p) {
5885
- await p;
5886
- }
5887
- } else {
5888
- await processLineBytes(pending.finish(void 0, chunk, start, offset));
6143
+ if (range >= 0 && start < 0) {
6144
+ if (range !== previousRange && emitted && outputDelimiter !== void 0) await writer.write(outputDelimiterBytes);
6145
+ start = position;
6146
+ emitted = true;
5889
6147
  }
5890
- start = offset + 1;
6148
+ position += character.length;
6149
+ previousRange = range;
5891
6150
  }
5892
- pending.append(chunk, start);
6151
+ if (start >= 0) await writer.text(text.slice(start));
5893
6152
  }
5894
- if (pending.size) {
5895
- const finalBytes = pending.finish();
5896
- if (fastSingleByteField && finalBytes.length <= 4096) {
5897
- const p = processFastFieldRange(finalBytes, 0, finalBytes.length);
6153
+ }
6154
+ const wd = writer.writeByte(recordDelimiter);
6155
+ if (wd) await wd;
6156
+ };
6157
+ const pending = new RecordBuffer(bufferLimit);
6158
+ try {
6159
+ for await (const chunk of input(context, name)) {
6160
+ let start = 0;
6161
+ while (start < chunk.length) {
6162
+ const offset = chunk.indexOf(recordDelimiter, start);
6163
+ if (offset < 0) break;
6164
+ if (fastSingleByteField && pending.size === 0 && offset - start <= 4096) {
6165
+ const p = processFastFieldRange(chunk, start, offset);
5898
6166
  if (p) await p;
6167
+ } else if (canFastSliceCut && pending.size === 0 && offset - start <= 4096) {
6168
+ const p = processFastSliceRange(chunk, start, offset);
6169
+ if (p === null) {
6170
+ await processLineBytes(chunk.subarray(start, offset));
6171
+ } else if (p) {
6172
+ await p;
6173
+ }
5899
6174
  } else {
5900
- await processLineBytes(finalBytes);
6175
+ await processLineBytes(pending.finish(void 0, chunk, start, offset));
5901
6176
  }
6177
+ start = offset + 1;
6178
+ }
6179
+ pending.append(chunk, start);
6180
+ }
6181
+ if (pending.size) {
6182
+ const finalBytes = pending.finish();
6183
+ if (fastSingleByteField && finalBytes.length <= 4096) {
6184
+ const p = processFastFieldRange(finalBytes, 0, finalBytes.length);
6185
+ if (p) await p;
6186
+ } else {
6187
+ await processLineBytes(finalBytes);
5902
6188
  }
5903
- } finally {
5904
- pending.clear();
5905
6189
  }
5906
6190
  } finally {
5907
- await writer.flush();
6191
+ pending.clear();
5908
6192
  }
5909
- } catch (error) {
5910
- await diagnostic(context, error);
5911
- exitCode = 1;
6193
+ } finally {
6194
+ await writer.flush();
5912
6195
  }
6196
+ } catch (error) {
6197
+ await diagnostic(context, error);
6198
+ exitCode = 1;
5913
6199
  }
5914
- } finally {
5915
- writer.release();
5916
6200
  }
5917
6201
  return { exitCode };
5918
6202
  }
@@ -5924,12 +6208,12 @@ async function executeUniqGeneral(context, preReadSource) {
5924
6208
  let ended = false;
5925
6209
  let repeatedMethod = "none";
5926
6210
  let groupMethod;
5927
- const args = context.args.map((argument2) => {
5928
- if (ended) return argument2;
5929
- if (argument2 === "--") ended = true;
5930
- if (argument2 === "--all-repeated") return "--all-repeated=none";
5931
- if (argument2 === "--group") return "--group=separate";
5932
- return argument2;
6211
+ const args = context.args.map((argument) => {
6212
+ if (ended) return argument;
6213
+ if (argument === "--") ended = true;
6214
+ if (argument === "--all-repeated") return "--all-repeated=none";
6215
+ if (argument === "--group") return "--group=separate";
6216
+ return argument;
5933
6217
  });
5934
6218
  const parsed = options(args, "cduiDf:s:w:z", { count: "c", repeated: "d", unique: "u", "all-repeated": "all-repeated:", group: "group:", "ignore-case": "i", "skip-fields": "f", "skip-chars": "s", "check-chars": "w", "zero-terminated": "z" }, false, void 0, void 0, (option, method) => {
5935
6219
  if (option === "D") repeatedMethod = "none";
@@ -6129,22 +6413,6 @@ function textCommands() {
6129
6413
  } catch (error) {
6130
6414
  return diagnostic(context, error).then(RETURN_EXIT_TWO);
6131
6415
  }
6132
- const cached = lastSort;
6133
- if (cached !== void 0 && firstChunkLen >= 256 && firstChunkLen === cached.input.byteLength && direction === cached.direction && cached.maxLineLength <= bufferLimit && equalBytes(cached.input, rawFirst)) {
6134
- let res2Fast;
6135
- try {
6136
- res2Fast = srcIter.tryNextSync();
6137
- } catch (error) {
6138
- return diagnostic(context, error).then(RETURN_EXIT_TWO);
6139
- }
6140
- if (res2Fast !== void 0 && res2Fast.done) {
6141
- context.signal.throwIfAborted();
6142
- const p = outputRange(context, cached.output, cached.output.length);
6143
- if (isSyncResolved2(p)) return RESOLVED_EXIT_ZERO;
6144
- return p.then(RETURN_EXIT_ZERO);
6145
- }
6146
- return executeSortFastContinueAsync(context, direction, srcIter, cached.input, res2Fast);
6147
- }
6148
6416
  let firstChunk;
6149
6417
  let usedSortInScratch = false;
6150
6418
  try {
@@ -6166,11 +6434,9 @@ function textCommands() {
6166
6434
  let start = 0;
6167
6435
  let count = 0;
6168
6436
  let validLines = true;
6169
- let maxSortLine = 0;
6170
6437
  while (start < firstChunkLen) {
6171
6438
  const offset = firstChunk.indexOf(10, start);
6172
6439
  const lLen = offset - start;
6173
- if (lLen > maxSortLine) maxSortLine = lLen;
6174
6440
  if (offset < 0 || offset >= firstChunkLen || count >= 4096 || lLen > bufferLimit) {
6175
6441
  validLines = false;
6176
6442
  break;
@@ -6218,7 +6484,7 @@ function textCommands() {
6218
6484
  src = dst;
6219
6485
  dst = tmp;
6220
6486
  }
6221
- const outBuf = sharedSortOutScratch;
6487
+ const outBuf = new Uint8Array(65536);
6222
6488
  let used = 0;
6223
6489
  for (let i = 0; i < count; i++) {
6224
6490
  const idx = src[i];
@@ -6227,14 +6493,6 @@ function textCommands() {
6227
6493
  for (let p2 = s; p2 < e; p2++) outBuf[used++] = firstChunk[p2];
6228
6494
  outBuf[used++] = 10;
6229
6495
  }
6230
- if (firstChunkLen >= 256 && used <= 32768) {
6231
- lastSort = {
6232
- input: encodeBytes(firstChunk.subarray(0, firstChunkLen)),
6233
- output: outBuf.slice(0, used),
6234
- direction,
6235
- maxLineLength: maxSortLine
6236
- };
6237
- }
6238
6496
  const p = outputRange(context, outBuf, used);
6239
6497
  if (isSyncResolved2(p)) return RESOLVED_EXIT_ZERO;
6240
6498
  return p.then(RETURN_EXIT_ZERO);
@@ -6245,7 +6503,10 @@ function textCommands() {
6245
6503
  } catch (error) {
6246
6504
  return diagnostic(context, error).then(RETURN_EXIT_TWO);
6247
6505
  } finally {
6248
- if (usedSortInScratch) sharedSortInUse = false;
6506
+ if (usedSortInScratch) {
6507
+ sharedSortInScratch.fill(0);
6508
+ sharedSortInUse = false;
6509
+ }
6249
6510
  }
6250
6511
  }
6251
6512
  }
@@ -6298,7 +6559,7 @@ function textCommands() {
6298
6559
  return diagnostic(context, error).then(RETURN_EXIT_ONE);
6299
6560
  }
6300
6561
  if (res2 !== void 0 && res2.done && chunk.length <= 65536) {
6301
- const outBuf = sharedUniqOutBuffer;
6562
+ const outBuf = new Uint8Array(128 * 1024);
6302
6563
  let outUsed = 0;
6303
6564
  let prevStart = -1;
6304
6565
  let prevEnd = -1;
@@ -6480,7 +6741,7 @@ function textCommands() {
6480
6741
  }
6481
6742
  if (canFast && (targetField >= 1 || fieldMask !== 0 && typeof context.stdin.tryReadAllSync === "function")) {
6482
6743
  const req = assertInputRequirements(context, operand !== void 0 ? [operand] : EMPTY_OPERANDS);
6483
- if (!req && operand === void 0 && !sharedCutOutInUse) {
6744
+ if (!req && operand === void 0) {
6484
6745
  const srcIter = input(context, "-")[Symbol.asyncIterator]();
6485
6746
  if (typeof srcIter.tryNextSync === "function") {
6486
6747
  let res1;
@@ -6498,18 +6759,10 @@ function textCommands() {
6498
6759
  } catch (error) {
6499
6760
  return diagnostic(context, error).then(RETURN_EXIT_ONE);
6500
6761
  }
6501
- if (res2 !== void 0 && res2.done && chunk.length < sharedCutOutBuffer.length) {
6502
- if (fieldMask === 0 && lastCutOutUsed >= 0 && chunk.length >= 256 && lastCutInBuf !== void 0 && chunk.length === lastCutInBuf.byteLength && sepByte === lastCutSep && targetField === lastCutField && lastCutMaxLineLen <= bufferLimit && equalBytes(lastCutInBuf, chunk)) {
6503
- context.signal.throwIfAborted();
6504
- if (lastCutOutUsed === 0) return RESOLVED_EXIT_ZERO;
6505
- const p2 = outputRange(context, cachedCutOutBuffer, lastCutOutUsed);
6506
- if (isSyncResolved2(p2)) return RESOLVED_EXIT_ZERO;
6507
- return p2.then(RETURN_EXIT_ZERO);
6508
- }
6509
- const outBuf = sharedCutOutBuffer;
6762
+ if (res2 !== void 0 && res2.done && chunk.length < 65536) {
6763
+ const outBuf = new Uint8Array(65536);
6510
6764
  let outUsed = 0;
6511
6765
  let start = 0;
6512
- let maxCutLine = 0;
6513
6766
  while (start < chunk.length) {
6514
6767
  let offset = chunk.indexOf(10, start);
6515
6768
  const hasNewline = offset >= 0;
@@ -6522,7 +6775,6 @@ function textCommands() {
6522
6775
  context.signal.throwIfAborted();
6523
6776
  let boundary = chunk.indexOf(sepByte, start);
6524
6777
  if (boundary >= offset) boundary = -1;
6525
- if (offset - start > maxCutLine) maxCutLine = offset - start;
6526
6778
  if (fieldMask !== 0 && boundary >= 0) {
6527
6779
  let f = 1;
6528
6780
  let curStart = start;
@@ -6565,14 +6817,6 @@ function textCommands() {
6565
6817
  }
6566
6818
  start = offset + 1;
6567
6819
  }
6568
- if (fieldMask === 0 && chunk.length >= 256 && outUsed <= 32768) {
6569
- lastCutInBuf = encodeBytes(chunk);
6570
- lastCutSep = sepByte;
6571
- lastCutField = targetField;
6572
- lastCutMaxLineLen = maxCutLine;
6573
- lastCutOutUsed = outUsed;
6574
- cachedCutOutBuffer.set(outBuf.subarray(0, outUsed));
6575
- }
6576
6820
  if (outUsed === 0) return RESOLVED_EXIT_ZERO;
6577
6821
  const p = outputRange(context, outBuf, outUsed);
6578
6822
  if (isSyncResolved2(p)) return RESOLVED_EXIT_ZERO;
@@ -6588,7 +6832,7 @@ function textCommands() {
6588
6832
  }
6589
6833
  return executeCutGeneral(context);
6590
6834
  })
6591
- ].map((command2) => ({ ...command2, filesystemRequirements: command2.name === "cut" ? inputRequirements : textOutputRequirements }));
6835
+ ].map((command) => ({ ...command, filesystemRequirements: command.name === "cut" ? inputRequirements : textOutputRequirements }));
6592
6836
  }
6593
6837
  async function executeSortFastAsync(context, direction, req) {
6594
6838
  await req;
@@ -6679,9 +6923,7 @@ async function executeSortFastContinueAsync(context, direction, srcIter, initial
6679
6923
  }
6680
6924
  async function executeCutFastAsync(context, operand, sepByte, targetField, req, existingIter, initialFirstChunk, initialSecondRes) {
6681
6925
  if (req) await req;
6682
- const ownsShared = !sharedCutOutInUse;
6683
- if (ownsShared) sharedCutOutInUse = true;
6684
- const outBuf = ownsShared ? sharedCutOutBuffer : new Uint8Array(65536);
6926
+ const outBuf = new Uint8Array(65536);
6685
6927
  let outUsed = 0;
6686
6928
  const isPipeStage = Boolean(context.stdout.isPipeStage);
6687
6929
  const syncSink = !isPipeStage ? context.stdout : void 0;
@@ -6812,8 +7054,6 @@ async function executeCutFastAsync(context, operand, sepByte, targetField, req,
6812
7054
  } catch (error) {
6813
7055
  await diagnostic(context, error);
6814
7056
  return { exitCode: 1 };
6815
- } finally {
6816
- if (ownsShared) sharedCutOutInUse = false;
6817
7057
  }
6818
7058
  }
6819
7059
 
@@ -6822,7 +7062,7 @@ init_platform();
6822
7062
 
6823
7063
  // packages/safe-bash/src/commands/shuf/index.ts
6824
7064
  init_platform();
6825
- import { RandomIntegers, createShufCommand, createShufCommands as createShufCommands2, evalSyncShuf, settings as settings6, shufCommands } from "../../safe-bash-command-shuf/index.js";
7065
+ import { RandomIntegers, createShufCommand as createShufCommand2, createShufCommands as createShufCommands2, evalSyncShuf, settings as settings19, shufCommands as shufCommands2 } from "../../safe-bash-command-shuf/index.js";
6826
7066
 
6827
7067
  // packages/safe-bash/src/commands/standard.ts
6828
7068
  var defaultBaseStandardCommands;
@@ -6830,12 +7070,12 @@ var defaultTailStandardCommands;
6830
7070
  function createStandardCommandsWithGrep(options2, grep) {
6831
7071
  const commands = [];
6832
7072
  const execute = directExecutor(options2.execute ?? (async (context) => {
6833
- const command2 = commands.find((definition) => definition.name === context.command);
6834
- if (command2) return command2.execute(context);
7073
+ const command = commands.find((definition) => definition.name === context.command);
7074
+ if (command) return command.execute(context);
6835
7075
  await diagnostic(context, new PublicDiagnostic("command not found"));
6836
7076
  return { exitCode: 127 };
6837
7077
  }));
6838
- if (options2.maxDirectoryEntries === void 0 && options2.maxTeeTargets === void 0 && options2.maxTailFollowHandles === void 0 && options2.predicateIdentity === void 0) {
7078
+ if (options2.maxDirectoryEntries === void 0 && options2.maxRecursiveDirectoryDepth === void 0 && options2.maxTeeTargets === void 0 && options2.maxTailFollowHandles === void 0 && options2.predicateIdentity === void 0) {
6839
7079
  defaultBaseStandardCommands ??= Object.freeze([
6840
7080
  ...basicCommands(),
6841
7081
  ...filesystemCommands(void 0),
@@ -6846,7 +7086,7 @@ function createStandardCommandsWithGrep(options2, grep) {
6846
7086
  ...predicateCommands(void 0),
6847
7087
  cmpCommand(),
6848
7088
  fmtCommand(),
6849
- createShufCommand(),
7089
+ createShufCommand2(),
6850
7090
  numfmtCommand()
6851
7091
  ]);
6852
7092
  commands.push(
@@ -6859,8 +7099,8 @@ function createStandardCommandsWithGrep(options2, grep) {
6859
7099
  for (let i = 0; i < commands.length; i++) builtInDirectContextExecutors.add(commands[i].execute);
6860
7100
  return commands;
6861
7101
  }
6862
- commands.push(...basicCommands(), ...filesystemCommands(options2.maxDirectoryEntries), ...streamCommands(options2.maxTeeTargets, options2.maxTailFollowHandles), ...textCommands(), ...grep, ...predicateCommands(options2.predicateIdentity), ...executionCommands(execute, options2.execution), ...createFindDefinitions(execute, options2.maxDirectoryEntries));
6863
- commands.push(cmpCommand(), fmtCommand(), createShufCommand(), numfmtCommand());
7102
+ commands.push(...basicCommands(), ...filesystemCommands(options2.maxDirectoryEntries, options2.maxRecursiveDirectoryDepth), ...streamCommands(options2.maxTeeTargets, options2.maxTailFollowHandles), ...textCommands(), ...grep, ...predicateCommands(options2.predicateIdentity), ...executionCommands(execute, options2.execution), ...createFindDefinitions(execute, options2.maxDirectoryEntries));
7103
+ commands.push(cmpCommand(), fmtCommand(), createShufCommand2(), numfmtCommand());
6864
7104
  for (let i = 0; i < commands.length; i++) builtInDirectContextExecutors.add(commands[i].execute);
6865
7105
  return commands;
6866
7106
  }
@@ -6876,18 +7116,13 @@ import { alias, createGrepAliases } from "../../safe-bash-io-engine/commands/gre
6876
7116
  // packages/safe-bash/src/plugins/composition.ts
6877
7117
  import { createExprCommandWithExecutor } from "../../safe-bash-command-expr/command.js";
6878
7118
  import { createCsplitCommandWithExecutor } from "../../safe-bash-command-csplit/command.js";
6879
- var defaultMuscleMemoryLookup;
6880
- function getExtraAgentCommand(name) {
6881
- defaultMuscleMemoryLookup ??= new Map(createExtraAgentCommands().map((cmd) => [cmd.name, cmd]));
6882
- return defaultMuscleMemoryLookup.get(name);
6883
- }
6884
7119
  function createExtraAgentCommands(options2) {
6885
7120
  return [...createBcCommands(options2?.bc), ...createSpongeCommands(options2?.sponge), ...createOpensslCommands(), ...createSshCommands(), ...createGpgCommands(), ...createFdCommands(options2?.fd), ...createLessCommands(options2?.less), ...createIdCommands(), ...createWhoamiCommands(), ...createUnameCommands(), ...createHostnameCommands(), ...createNprocCommands(), ...createShufCommands(), ...createYesCommands(), ...createDdCommands(), ...createNumfmtCommands(), ...createEnvsubstCommands(), ...createCalCommands(), ...createPathchkCommands(), ...createGetconfCommands(), ...createLocaleCommands(), ...createDfCommands(), ...createSqlite3Commands(options2?.sqlite3)];
6886
7121
  }
6887
7122
  function commandExecutor(lookup) {
6888
7123
  return async (context) => {
6889
- const command2 = lookup(context.command) ?? getExtraAgentCommand(context.command);
6890
- if (command2) return command2.execute(context);
7124
+ const command = lookup(context.command);
7125
+ if (command) return command.execute(context);
6891
7126
  await diagnostic(context, new PublicDiagnostic("command not found"));
6892
7127
  return { exitCode: 127 };
6893
7128
  };
@@ -6946,7 +7181,7 @@ function composeRawAgentCommands(options2, executors, additionalCommands = []) {
6946
7181
  const defaults = getDefaultStatelessFamilies();
6947
7182
  const aliasesGrep = executors.aliases === executors.grep ? grep[0] : createGrepCommands(executors.aliases, { ergonomicRegex: useErgonomicGrep })[0];
6948
7183
  commands.push(
6949
- ...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((command2) => command2.name === name)), ...options2.execution === void 0 ? {} : { execution: options2.execution }, ...options2.regex === void 0 ? {} : { regex: options2.regex }, ...options2.maxDirectoryEntries === void 0 ? {} : { maxDirectoryEntries: options2.maxDirectoryEntries }, ...options2.maxTeeTargets === void 0 ? {} : { maxTeeTargets: options2.maxTeeTargets }, ...options2.maxTailFollowHandles === void 0 ? {} : { maxTailFollowHandles: options2.maxTailFollowHandles } }, grep),
7184
+ ...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((command) => command.name === name)), ...options2.execution === void 0 ? {} : { execution: options2.execution }, ...options2.regex === void 0 ? {} : { regex: options2.regex }, ...options2.maxDirectoryEntries === void 0 ? {} : { maxDirectoryEntries: options2.maxDirectoryEntries }, ...options2.maxRecursiveDirectoryDepth === void 0 ? {} : { maxRecursiveDirectoryDepth: options2.maxRecursiveDirectoryDepth }, ...options2.maxTeeTargets === void 0 ? {} : { maxTeeTargets: options2.maxTeeTargets }, ...options2.maxTailFollowHandles === void 0 ? {} : { maxTailFollowHandles: options2.maxTailFollowHandles } }, grep),
6950
7185
  ...defaults.beforeAliases,
6951
7186
  createRgCommand(executors.search, options2.search),
6952
7187
  ...createGrepAliases(aliasesGrep),
@@ -6973,7 +7208,7 @@ function composeRawAgentCommands(options2, executors, additionalCommands = []) {
6973
7208
  const applyPatchLimits = options2.applyPatch?.limits;
6974
7209
  const xmlLimits = options2.xml?.limits;
6975
7210
  commands.push(
6976
- ...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((command2) => command2.name === name)), ...options2.execution === void 0 ? {} : { execution: options2.execution }, ...options2.regex === void 0 ? {} : { regex: options2.regex }, ...options2.maxDirectoryEntries === void 0 ? {} : { maxDirectoryEntries: options2.maxDirectoryEntries }, ...options2.maxTeeTargets === void 0 ? {} : { maxTeeTargets: options2.maxTeeTargets }, ...options2.maxTailFollowHandles === void 0 ? {} : { maxTailFollowHandles: options2.maxTailFollowHandles } }, grep).filter((command2) => !options2.muscleMemory || command2.name !== "shuf" && command2.name !== "numfmt"),
7211
+ ...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((command) => command.name === name)), ...options2.execution === void 0 ? {} : { execution: options2.execution }, ...options2.regex === void 0 ? {} : { regex: options2.regex }, ...options2.maxDirectoryEntries === void 0 ? {} : { maxDirectoryEntries: options2.maxDirectoryEntries }, ...options2.maxRecursiveDirectoryDepth === void 0 ? {} : { maxRecursiveDirectoryDepth: options2.maxRecursiveDirectoryDepth }, ...options2.maxTeeTargets === void 0 ? {} : { maxTeeTargets: options2.maxTeeTargets }, ...options2.maxTailFollowHandles === void 0 ? {} : { maxTailFollowHandles: options2.maxTailFollowHandles } }, grep).filter((command) => !options2.muscleMemory || command.name !== "shuf" && command.name !== "numfmt"),
6977
7212
  ...createTextProgramCommands({ ...options2.text }),
6978
7213
  ...createStructuredCommands({ ...options2.structured }),
6979
7214
  createRgCommand(executors.search, options2.search),
@@ -7056,6 +7291,9 @@ function createAgentCommandPlugin(options2, executors, additionalCommands = [])
7056
7291
  }
7057
7292
 
7058
7293
  export {
7294
+ createNumfmtCommand,
7295
+ createNumfmtCommands,
7296
+ numfmtCommands,
7059
7297
  createStandardCommandsWithGrep,
7060
7298
  sedCommand,
7061
7299
  createTextProgramCommands,
@@ -7072,19 +7310,12 @@ export {
7072
7310
  xxdCommands,
7073
7311
  createByteCommands,
7074
7312
  byteCommands,
7075
- createTableTextCommands,
7076
- tableTextCommands,
7077
- createSplitCommand,
7078
- createSplitCommands,
7079
- evalSyncSplit,
7080
- splitCommands,
7081
- columnCommands,
7082
- createColumnCommand,
7083
- createColumnCommands,
7084
- applyPatchCommands,
7085
- createApplyPatchCommand,
7086
- createApplyPatchCommands,
7087
- evalSyncApplyPatch,
7313
+ createBcCommand,
7314
+ createBcCommands,
7315
+ bcCommands,
7316
+ createSpongeCommand,
7317
+ createSpongeCommands,
7318
+ spongeCommands,
7088
7319
  createOpensslCommand,
7089
7320
  createOpensslCommands,
7090
7321
  opensslCommands,
@@ -7095,9 +7326,42 @@ export {
7095
7326
  createGpgCommand,
7096
7327
  createGpgCommands,
7097
7328
  gpgCommands,
7329
+ createIdCommand,
7330
+ createIdCommands,
7331
+ idCommands,
7332
+ createWhoamiCommand,
7333
+ createWhoamiCommands,
7334
+ whoamiCommands,
7335
+ createUnameCommand,
7336
+ createUnameCommands,
7337
+ unameCommands,
7338
+ createHostnameCommand,
7339
+ createHostnameCommands,
7340
+ hostnameCommands,
7341
+ createNprocCommand,
7342
+ createNprocCommands,
7343
+ nprocCommands,
7344
+ createShufCommand,
7345
+ createShufCommands,
7346
+ shufCommands,
7098
7347
  createYesCommand,
7099
7348
  createYesCommands,
7100
7349
  yesCommands,
7350
+ createDdCommand,
7351
+ createDdCommands,
7352
+ ddCommands,
7353
+ createEnvsubstCommand,
7354
+ createEnvsubstCommands,
7355
+ envsubstCommands,
7356
+ createGetconfCommand,
7357
+ createGetconfCommands,
7358
+ getconfCommands,
7359
+ createLocaleCommand,
7360
+ createLocaleCommands,
7361
+ localeCommands,
7362
+ createSqlite3Command,
7363
+ createSqlite3Commands,
7364
+ sqlite3Commands,
7101
7365
  composeAgentCommands,
7102
7366
  createRegexExecutors,
7103
7367
  baseAgentCommands,