just-bash 2.12.4 → 2.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/dist/banned-patterns-test.d.ts +0 -7
  2. package/dist/bin/chunks/{awk2-RGDNV4HO.js → awk2-EB5SCHVW.js} +1 -1
  3. package/dist/bin/{shell/chunks/chmod-4O2C4V42.js → chunks/chmod-N5CQATDW.js} +1 -1
  4. package/dist/bin/{shell/chunks/chunk-WO4B7WUT.js → chunks/chunk-5MUD3WB2.js} +1 -1
  5. package/dist/bin/chunks/chunk-7ADG3DNO.js +8 -0
  6. package/dist/bin/{shell/chunks/chunk-Q4WHWGOT.js → chunks/chunk-BBRVF6XE.js} +1 -1
  7. package/dist/bin/chunks/chunk-DHFZMFUW.js +36 -0
  8. package/dist/bin/chunks/{chunk-LHN3LRVT.js → chunk-IRCLOW32.js} +20 -20
  9. package/dist/bin/chunks/chunk-JX6YLHDX.js +2 -0
  10. package/dist/bin/chunks/chunk-MY5PY2PL.js +2 -0
  11. package/dist/bin/chunks/chunk-NTKUVXEL.js +5 -0
  12. package/dist/bin/chunks/{chunk-OKL2SPHK.js → chunk-O5B6WWQQ.js} +39 -39
  13. package/dist/bin/chunks/{chunk-DGFDVZ4N.js → chunk-OLN6BSO3.js} +1 -1
  14. package/dist/bin/chunks/chunk-OQV5J23L.js +7 -0
  15. package/dist/bin/chunks/chunk-PIBXJ3VX.js +13 -0
  16. package/dist/bin/chunks/chunk-PLKGKTIS.js +6 -0
  17. package/dist/bin/{shell/chunks/chunk-J4WYAO5Q.js → chunks/chunk-QTII62YM.js} +13 -13
  18. package/dist/bin/chunks/chunk-QZNF3Y3J.js +2 -0
  19. package/dist/bin/chunks/chunk-R2LDP472.js +8 -0
  20. package/dist/bin/chunks/chunk-ROMKUVHI.js +10 -0
  21. package/dist/bin/chunks/chunk-STOAUD75.js +11 -0
  22. package/dist/bin/chunks/chunk-SXB55JOI.js +2 -0
  23. package/dist/bin/chunks/chunk-VCKKRS7V.js +12 -0
  24. package/dist/bin/chunks/{chunk-SY2WM5RM.js → chunk-VIYJJTN2.js} +5 -5
  25. package/dist/bin/{shell/chunks/chunk-GA6KXSOC.js → chunks/chunk-YFPDB4PH.js} +1 -1
  26. package/dist/bin/chunks/chunk-YMMJLYIX.js +2 -0
  27. package/dist/bin/chunks/chunk-YTIURC67.js +2 -0
  28. package/dist/bin/chunks/chunk-YWZOGBFE.js +9 -0
  29. package/dist/bin/chunks/chunk-YX7OOTPO.js +9 -0
  30. package/dist/bin/chunks/chunk-ZJGIBTWD.js +2 -0
  31. package/dist/bin/chunks/{chunk-Q3FNZYGG.js → chunk-ZNPXCE5B.js} +99 -99
  32. package/dist/bin/chunks/chunk-ZSVBYEY4.js +6 -0
  33. package/dist/bin/chunks/curl-3GMIPMCI.js +26 -0
  34. package/dist/bin/{shell/chunks/expansion-TCB3WZP5.js → chunks/expansion-JBCP2CHQ.js} +1 -1
  35. package/dist/bin/chunks/find-MTLF23HX.js +2 -0
  36. package/dist/bin/chunks/flag-coverage-7GOZYXJT.js +2 -0
  37. package/dist/bin/{shell/chunks/grep-F3GT2VPG.js → chunks/grep-OZJTRD4D.js} +1 -1
  38. package/dist/bin/chunks/jq-P457LMHU.js +2 -0
  39. package/dist/bin/chunks/{ln-BEOFQJNP.js → ln-VAOSD4HK.js} +1 -1
  40. package/dist/bin/chunks/mkdir-CH7JGW4N.js +2 -0
  41. package/dist/bin/chunks/python3-45TMCI4M.js +17 -0
  42. package/dist/bin/chunks/{readlink-YNOUXNUY.js → readlink-BD5VFOC5.js} +1 -1
  43. package/dist/bin/chunks/rm-GWYJO4W7.js +2 -0
  44. package/dist/bin/chunks/sed-UV2LTNVK.js +2 -0
  45. package/dist/bin/chunks/sleep-3WHM7JMW.js +2 -0
  46. package/dist/bin/chunks/{sqlite3-SJHZFBT2.js → sqlite3-B3P3OMPI.js} +1 -1
  47. package/dist/bin/chunks/stat-XS2LXYS2.js +2 -0
  48. package/dist/bin/chunks/tar-SO3XDDIW.js +2 -0
  49. package/dist/bin/chunks/time-GZSHCM77.js +2 -0
  50. package/dist/bin/chunks/timeout-BYB3L2JA.js +2 -0
  51. package/dist/bin/chunks/worker.js +229 -20
  52. package/dist/bin/chunks/xan-FZB7FHX3.js +2 -0
  53. package/dist/bin/chunks/yq-H7D2U3HS.js +2 -0
  54. package/dist/bin/just-bash.js +183 -183
  55. package/dist/bin/shell/chunks/{awk2-RGDNV4HO.js → awk2-EB5SCHVW.js} +1 -1
  56. package/dist/bin/{chunks/chmod-4O2C4V42.js → shell/chunks/chmod-N5CQATDW.js} +1 -1
  57. package/dist/bin/{chunks/chunk-WO4B7WUT.js → shell/chunks/chunk-5MUD3WB2.js} +1 -1
  58. package/dist/bin/shell/chunks/chunk-7ADG3DNO.js +8 -0
  59. package/dist/bin/{chunks/chunk-Q4WHWGOT.js → shell/chunks/chunk-BBRVF6XE.js} +1 -1
  60. package/dist/bin/shell/chunks/chunk-D64U2VGQ.js +2 -0
  61. package/dist/bin/shell/chunks/chunk-DHFZMFUW.js +36 -0
  62. package/dist/bin/shell/chunks/{chunk-LHN3LRVT.js → chunk-IRCLOW32.js} +20 -20
  63. package/dist/bin/shell/chunks/chunk-JX6YLHDX.js +2 -0
  64. package/dist/bin/shell/chunks/chunk-NTKUVXEL.js +5 -0
  65. package/dist/bin/shell/chunks/{chunk-OKL2SPHK.js → chunk-O5B6WWQQ.js} +39 -39
  66. package/dist/bin/shell/chunks/{chunk-DGFDVZ4N.js → chunk-OLN6BSO3.js} +1 -1
  67. package/dist/bin/shell/chunks/chunk-OQV5J23L.js +7 -0
  68. package/dist/bin/shell/chunks/chunk-PIBXJ3VX.js +13 -0
  69. package/dist/bin/shell/chunks/chunk-PLKGKTIS.js +6 -0
  70. package/dist/bin/{chunks/chunk-J4WYAO5Q.js → shell/chunks/chunk-QTII62YM.js} +13 -13
  71. package/dist/bin/shell/chunks/chunk-QZNF3Y3J.js +2 -0
  72. package/dist/bin/shell/chunks/chunk-R2LDP472.js +8 -0
  73. package/dist/bin/shell/chunks/chunk-ROMKUVHI.js +10 -0
  74. package/dist/bin/shell/chunks/chunk-STOAUD75.js +11 -0
  75. package/dist/bin/shell/chunks/chunk-SXB55JOI.js +2 -0
  76. package/dist/bin/shell/chunks/chunk-VCKKRS7V.js +12 -0
  77. package/dist/bin/shell/chunks/{chunk-SY2WM5RM.js → chunk-VIYJJTN2.js} +5 -5
  78. package/dist/bin/{chunks/chunk-GA6KXSOC.js → shell/chunks/chunk-YFPDB4PH.js} +1 -1
  79. package/dist/bin/shell/chunks/chunk-YMMJLYIX.js +2 -0
  80. package/dist/bin/shell/chunks/chunk-YTIURC67.js +2 -0
  81. package/dist/bin/shell/chunks/chunk-YWZOGBFE.js +9 -0
  82. package/dist/bin/shell/chunks/chunk-YX7OOTPO.js +9 -0
  83. package/dist/bin/shell/chunks/chunk-ZJGIBTWD.js +2 -0
  84. package/dist/bin/shell/chunks/{chunk-Q3FNZYGG.js → chunk-ZNPXCE5B.js} +99 -99
  85. package/dist/bin/shell/chunks/chunk-ZSVBYEY4.js +6 -0
  86. package/dist/bin/shell/chunks/curl-3GMIPMCI.js +26 -0
  87. package/dist/bin/{chunks/expansion-TCB3WZP5.js → shell/chunks/expansion-JBCP2CHQ.js} +1 -1
  88. package/dist/bin/shell/chunks/find-MTLF23HX.js +2 -0
  89. package/dist/bin/shell/chunks/flag-coverage-7GOZYXJT.js +2 -0
  90. package/dist/bin/{chunks/grep-F3GT2VPG.js → shell/chunks/grep-OZJTRD4D.js} +1 -1
  91. package/dist/bin/shell/chunks/jq-P457LMHU.js +2 -0
  92. package/dist/bin/shell/chunks/{ln-BEOFQJNP.js → ln-VAOSD4HK.js} +1 -1
  93. package/dist/bin/shell/chunks/mkdir-CH7JGW4N.js +2 -0
  94. package/dist/bin/shell/chunks/python3-IV3DBMHM.js +17 -0
  95. package/dist/bin/shell/chunks/{readlink-YNOUXNUY.js → readlink-BD5VFOC5.js} +1 -1
  96. package/dist/bin/shell/chunks/rm-GWYJO4W7.js +2 -0
  97. package/dist/bin/shell/chunks/sed-UV2LTNVK.js +2 -0
  98. package/dist/bin/shell/chunks/sleep-3WHM7JMW.js +2 -0
  99. package/dist/bin/shell/chunks/{sqlite3-SJHZFBT2.js → sqlite3-B3P3OMPI.js} +1 -1
  100. package/dist/bin/shell/chunks/stat-XS2LXYS2.js +2 -0
  101. package/dist/bin/shell/chunks/tar-SO3XDDIW.js +2 -0
  102. package/dist/bin/shell/chunks/time-GZSHCM77.js +2 -0
  103. package/dist/bin/shell/chunks/timeout-BYB3L2JA.js +2 -0
  104. package/dist/bin/shell/chunks/xan-FZB7FHX3.js +2 -0
  105. package/dist/bin/shell/chunks/yq-H7D2U3HS.js +2 -0
  106. package/dist/bin/shell/shell.js +187 -187
  107. package/dist/bundle/browser.js +632 -635
  108. package/dist/bundle/chunks/{awk2-XLDR2J4Q.js → awk2-VPBKDCSO.js} +1 -1
  109. package/dist/bundle/chunks/{chmod-MIKE3OIT.js → chmod-SYMGL4JA.js} +1 -1
  110. package/dist/bundle/chunks/chunk-3ZUFRYJ4.js +1 -0
  111. package/dist/bundle/chunks/chunk-4GTNDTRF.js +7 -0
  112. package/dist/bundle/chunks/{chunk-N4QLRJ32.js → chunk-4YPFHVJJ.js} +1 -1
  113. package/dist/bundle/chunks/chunk-5QVNJEHU.js +8 -0
  114. package/dist/bundle/chunks/chunk-64CW2LGZ.js +6 -0
  115. package/dist/bundle/chunks/chunk-6HBBXB3L.js +11 -0
  116. package/dist/bundle/chunks/chunk-72EQZSVH.js +4 -0
  117. package/dist/bundle/chunks/chunk-7YDOWJ75.js +1 -0
  118. package/dist/bundle/chunks/chunk-AUD37QB3.js +35 -0
  119. package/dist/bundle/chunks/{chunk-NTP6TTH5.js → chunk-BED5HSP2.js} +13 -13
  120. package/dist/bundle/chunks/{chunk-K5BTXJQC.js → chunk-C7ZTXK5C.js} +99 -99
  121. package/dist/bundle/chunks/chunk-D2FZX7A2.js +10 -0
  122. package/dist/bundle/chunks/chunk-DZZS6SJP.js +1 -0
  123. package/dist/bundle/chunks/{chunk-KAZYKNBG.js → chunk-EX62JIX3.js} +5 -5
  124. package/dist/bundle/chunks/chunk-FGALERPA.js +8 -0
  125. package/dist/bundle/chunks/chunk-HJWBQKYG.js +5 -0
  126. package/dist/bundle/chunks/chunk-IP7G3BNA.js +7 -0
  127. package/dist/bundle/chunks/chunk-J642UCRS.js +1 -0
  128. package/dist/bundle/chunks/chunk-KZ7BI7TV.js +5 -0
  129. package/dist/bundle/chunks/chunk-RH6GWZAJ.js +1 -0
  130. package/dist/bundle/chunks/{chunk-4VCAQZKQ.js → chunk-TRD56HID.js} +39 -39
  131. package/dist/bundle/chunks/chunk-U5FWK6IA.js +12 -0
  132. package/dist/bundle/chunks/{chunk-H4QOE4W3.js → chunk-VBF2GWEM.js} +20 -20
  133. package/dist/bundle/chunks/{chunk-2OHMPZNZ.js → chunk-VSWTMNI3.js} +1 -1
  134. package/dist/bundle/chunks/chunk-X2AJGDEF.js +1 -0
  135. package/dist/bundle/chunks/{chunk-T2EHE3CV.js → chunk-X36DXRVC.js} +1 -1
  136. package/dist/bundle/chunks/chunk-X3CVFNQZ.js +9 -0
  137. package/dist/bundle/chunks/chunk-XHM67O4N.js +1 -0
  138. package/dist/bundle/chunks/{chunk-CYTBPLPE.js → chunk-YS3AZT3J.js} +1 -1
  139. package/dist/bundle/chunks/curl-KM2ZAUR6.js +25 -0
  140. package/dist/bundle/chunks/{expansion-HJ6B4DDG.js → expansion-XG7G47TX.js} +1 -1
  141. package/dist/bundle/chunks/find-DOIVMX6X.js +1 -0
  142. package/dist/bundle/chunks/flag-coverage-NT32EG6Q.js +1 -0
  143. package/dist/bundle/chunks/{grep-LXKUQUAE.js → grep-3AIAIJVR.js} +1 -1
  144. package/dist/bundle/chunks/jq-NLRWI2Q6.js +1 -0
  145. package/dist/bundle/chunks/{ln-RI2SJGXU.js → ln-UJ6YJVBK.js} +1 -1
  146. package/dist/bundle/chunks/mkdir-F6XHPXZC.js +1 -0
  147. package/dist/bundle/chunks/python3-G2ZUJAQL.js +16 -0
  148. package/dist/bundle/chunks/{readlink-IEQO24KU.js → readlink-MI4GCHJF.js} +1 -1
  149. package/dist/bundle/chunks/rm-FYNVTQIU.js +1 -0
  150. package/dist/bundle/chunks/sed-2BILOGNL.js +1 -0
  151. package/dist/bundle/chunks/sleep-IUBP5GMH.js +1 -0
  152. package/dist/bundle/chunks/{sqlite3-CTI4ZW7L.js → sqlite3-VEDNWJL6.js} +1 -1
  153. package/dist/bundle/chunks/stat-BT5A227F.js +1 -0
  154. package/dist/bundle/chunks/tar-LKO7DKAK.js +1 -0
  155. package/dist/bundle/chunks/time-XL42Z4U5.js +1 -0
  156. package/dist/bundle/chunks/timeout-TL4Q5YKZ.js +1 -0
  157. package/dist/bundle/chunks/worker.js +229 -20
  158. package/dist/bundle/chunks/xan-KSDYKKEK.js +1 -0
  159. package/dist/bundle/chunks/yq-HIQ4WMDY.js +1 -0
  160. package/dist/bundle/index.cjs +857 -860
  161. package/dist/bundle/index.js +246 -246
  162. package/dist/commands/duration.d.ts +5 -0
  163. package/dist/commands/format-mode.d.ts +4 -0
  164. package/dist/commands/python3/worker.d.ts +1 -0
  165. package/dist/commands/query-engine/safe-object.d.ts +13 -0
  166. package/dist/commands/sed/types.d.ts +0 -4
  167. package/dist/commands/sqlite3/worker.d.ts +1 -0
  168. package/dist/commands/tar/archive.d.ts +18 -4
  169. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +0 -3
  170. package/dist/fs/mountable-fs/mountable-fs.d.ts +0 -4
  171. package/dist/fs/overlay-fs/overlay-fs.d.ts +6 -7
  172. package/dist/fs/path-utils.d.ts +46 -0
  173. package/dist/fs/read-write-fs/read-write-fs.d.ts +0 -4
  174. package/dist/fs/real-fs-utils.d.ts +17 -11
  175. package/dist/timers.d.ts +0 -3
  176. package/package.json +3 -2
  177. package/dist/bin/chunks/chunk-253LRF5J.js +0 -11
  178. package/dist/bin/chunks/chunk-4C4F4EKM.js +0 -2
  179. package/dist/bin/chunks/chunk-55QIFSKH.js +0 -36
  180. package/dist/bin/chunks/chunk-5VFN7VVJ.js +0 -9
  181. package/dist/bin/chunks/chunk-6MF2IYQX.js +0 -10
  182. package/dist/bin/chunks/chunk-D2GFNFUN.js +0 -7
  183. package/dist/bin/chunks/chunk-EO5AH4U7.js +0 -5
  184. package/dist/bin/chunks/chunk-GIFF636B.js +0 -2
  185. package/dist/bin/chunks/chunk-KWLLB7S3.js +0 -7
  186. package/dist/bin/chunks/chunk-NDP6L74Z.js +0 -10
  187. package/dist/bin/chunks/chunk-PWZZGTFL.js +0 -13
  188. package/dist/bin/chunks/chunk-UYBH3FNE.js +0 -2
  189. package/dist/bin/chunks/chunk-V5YFCVCZ.js +0 -12
  190. package/dist/bin/chunks/chunk-V7VIJQD6.js +0 -6
  191. package/dist/bin/chunks/chunk-WMYKQURM.js +0 -2
  192. package/dist/bin/chunks/chunk-XAL6VWGA.js +0 -9
  193. package/dist/bin/chunks/chunk-YYQ22ZRL.js +0 -8
  194. package/dist/bin/chunks/curl-RWQO3SBN.js +0 -26
  195. package/dist/bin/chunks/find-4YAO7JQS.js +0 -2
  196. package/dist/bin/chunks/flag-coverage-K6IBGWAC.js +0 -2
  197. package/dist/bin/chunks/jq-VBB2XIZS.js +0 -2
  198. package/dist/bin/chunks/mkdir-6OKMS3KO.js +0 -2
  199. package/dist/bin/chunks/python3-JX5PXXTX.js +0 -17
  200. package/dist/bin/chunks/rm-5QIBTLJG.js +0 -2
  201. package/dist/bin/chunks/sed-BYFYBR4A.js +0 -2
  202. package/dist/bin/chunks/sleep-E3K6M6BN.js +0 -2
  203. package/dist/bin/chunks/stat-XH7E4E2C.js +0 -2
  204. package/dist/bin/chunks/tar-W5GBTEDZ.js +0 -2
  205. package/dist/bin/chunks/time-AWAKKRSE.js +0 -2
  206. package/dist/bin/chunks/timeout-OLS72AZG.js +0 -2
  207. package/dist/bin/chunks/xan-BJ66NSYT.js +0 -2
  208. package/dist/bin/chunks/yq-GPYVGU2N.js +0 -2
  209. package/dist/bin/shell/chunks/chunk-253LRF5J.js +0 -11
  210. package/dist/bin/shell/chunks/chunk-4C4F4EKM.js +0 -2
  211. package/dist/bin/shell/chunks/chunk-55QIFSKH.js +0 -36
  212. package/dist/bin/shell/chunks/chunk-5VFN7VVJ.js +0 -9
  213. package/dist/bin/shell/chunks/chunk-6MF2IYQX.js +0 -10
  214. package/dist/bin/shell/chunks/chunk-D2GFNFUN.js +0 -7
  215. package/dist/bin/shell/chunks/chunk-EO5AH4U7.js +0 -5
  216. package/dist/bin/shell/chunks/chunk-GIFF636B.js +0 -2
  217. package/dist/bin/shell/chunks/chunk-KWLLB7S3.js +0 -7
  218. package/dist/bin/shell/chunks/chunk-NDP6L74Z.js +0 -10
  219. package/dist/bin/shell/chunks/chunk-PWZZGTFL.js +0 -13
  220. package/dist/bin/shell/chunks/chunk-UYBH3FNE.js +0 -2
  221. package/dist/bin/shell/chunks/chunk-V5YFCVCZ.js +0 -12
  222. package/dist/bin/shell/chunks/chunk-V7VIJQD6.js +0 -6
  223. package/dist/bin/shell/chunks/chunk-WMYKQURM.js +0 -2
  224. package/dist/bin/shell/chunks/chunk-XAL6VWGA.js +0 -9
  225. package/dist/bin/shell/chunks/chunk-YYQ22ZRL.js +0 -8
  226. package/dist/bin/shell/chunks/curl-RWQO3SBN.js +0 -26
  227. package/dist/bin/shell/chunks/find-4YAO7JQS.js +0 -2
  228. package/dist/bin/shell/chunks/flag-coverage-K6IBGWAC.js +0 -2
  229. package/dist/bin/shell/chunks/jq-VBB2XIZS.js +0 -2
  230. package/dist/bin/shell/chunks/mkdir-6OKMS3KO.js +0 -2
  231. package/dist/bin/shell/chunks/python3-JX5PXXTX.js +0 -17
  232. package/dist/bin/shell/chunks/rm-5QIBTLJG.js +0 -2
  233. package/dist/bin/shell/chunks/sed-BYFYBR4A.js +0 -2
  234. package/dist/bin/shell/chunks/sleep-E3K6M6BN.js +0 -2
  235. package/dist/bin/shell/chunks/stat-XH7E4E2C.js +0 -2
  236. package/dist/bin/shell/chunks/tar-W5GBTEDZ.js +0 -2
  237. package/dist/bin/shell/chunks/time-AWAKKRSE.js +0 -2
  238. package/dist/bin/shell/chunks/timeout-OLS72AZG.js +0 -2
  239. package/dist/bin/shell/chunks/xan-BJ66NSYT.js +0 -2
  240. package/dist/bin/shell/chunks/yq-GPYVGU2N.js +0 -2
  241. package/dist/bundle/chunks/chunk-27LMNKBP.js +0 -7
  242. package/dist/bundle/chunks/chunk-3RCXHB4E.js +0 -4
  243. package/dist/bundle/chunks/chunk-7MKBHGLS.js +0 -1
  244. package/dist/bundle/chunks/chunk-DOTBQEPN.js +0 -5
  245. package/dist/bundle/chunks/chunk-GENDESYN.js +0 -1
  246. package/dist/bundle/chunks/chunk-GZ2N3SXD.js +0 -8
  247. package/dist/bundle/chunks/chunk-IJXFPKNC.js +0 -1
  248. package/dist/bundle/chunks/chunk-IKZ5LEGB.js +0 -6
  249. package/dist/bundle/chunks/chunk-OFJTSXN6.js +0 -8
  250. package/dist/bundle/chunks/chunk-QUME7R6S.js +0 -9
  251. package/dist/bundle/chunks/chunk-TBAWQWQB.js +0 -12
  252. package/dist/bundle/chunks/chunk-VYV3YE2F.js +0 -35
  253. package/dist/bundle/chunks/chunk-W42IGK5R.js +0 -11
  254. package/dist/bundle/chunks/chunk-WAN3B6E3.js +0 -9
  255. package/dist/bundle/chunks/chunk-XZ3MZS57.js +0 -6
  256. package/dist/bundle/chunks/chunk-YCABLDKV.js +0 -10
  257. package/dist/bundle/chunks/chunk-ZK6J6F7O.js +0 -1
  258. package/dist/bundle/chunks/curl-6L7YZUIH.js +0 -25
  259. package/dist/bundle/chunks/find-DQFMWHAC.js +0 -1
  260. package/dist/bundle/chunks/flag-coverage-VGF5NAZP.js +0 -1
  261. package/dist/bundle/chunks/jq-JQXAVWNT.js +0 -1
  262. package/dist/bundle/chunks/mkdir-QWGXDWUS.js +0 -1
  263. package/dist/bundle/chunks/python3-TSPOVUHX.js +0 -16
  264. package/dist/bundle/chunks/rm-KPTLPKPH.js +0 -1
  265. package/dist/bundle/chunks/sed-CJFW7UYO.js +0 -1
  266. package/dist/bundle/chunks/sleep-TFDNFOXK.js +0 -1
  267. package/dist/bundle/chunks/stat-74KBZFAX.js +0 -1
  268. package/dist/bundle/chunks/tar-Y6LP5EBC.js +0 -1
  269. package/dist/bundle/chunks/time-WBKSMCJ6.js +0 -1
  270. package/dist/bundle/chunks/timeout-O7WSXY5H.js +0 -1
  271. package/dist/bundle/chunks/xan-VMLUNIDS.js +0 -1
  272. package/dist/bundle/chunks/yq-QXIYE3MW.js +0 -1
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Parse a duration string (e.g. "5s", "1m", "2h", "1d") to milliseconds.
3
+ * Returns null if the string is not a valid duration.
4
+ */
5
+ export declare function parseDuration(arg: string): number | null;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Format a numeric file mode as a symbolic permission string (e.g. "drwxr-xr-x").
3
+ */
4
+ export declare function formatMode(mode: number, isDirectory: boolean): string;
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import { type WorkerDefenseStats } from "../../security/index.js";
13
13
  export interface WorkerInput {
14
+ protocolToken: string;
14
15
  sharedBuffer: SharedArrayBuffer;
15
16
  pythonCode: string;
16
17
  cwd: string;
@@ -47,6 +47,19 @@ export declare function safeCopy<T extends Record<string, unknown>>(obj: T): T;
47
47
  * Check if object has own property safely (not inherited from prototype).
48
48
  */
49
49
  export declare function safeHasOwn(obj: object, key: string): boolean;
50
+ /**
51
+ * SECURITY: Recursively convert parsed data to null-prototype objects.
52
+ * Call this on ALL data from untrusted parsers (JSON.parse, YAML.parse, etc.)
53
+ * to eliminate prototype chain access at the boundary.
54
+ * All keys (including __proto__, constructor) are preserved as own properties —
55
+ * the defense is null-prototype, not key filtering.
56
+ */
57
+ export declare function sanitizeParsedData(value: unknown): unknown;
58
+ /**
59
+ * Type-safe cast from unknown to Record for property access.
60
+ * Returns null if the value is not a non-array object.
61
+ */
62
+ export declare function asQueryRecord(value: unknown): Record<string, unknown> | null;
50
63
  /**
51
64
  * Create a null-prototype shallow copy of an object.
52
65
  * This prevents prototype chain lookups without filtering any keys.
@@ -199,10 +199,6 @@ export interface SedState {
199
199
  filename: string;
200
200
  content: string;
201
201
  }>;
202
- pendingExecute?: {
203
- command: string;
204
- replacePattern: boolean;
205
- };
206
202
  rangeStates: Map<string, RangeState>;
207
203
  lastPattern?: string;
208
204
  branchRequest?: string;
@@ -14,6 +14,7 @@
14
14
  */
15
15
  import { type WorkerDefenseStats } from "../../security/index.js";
16
16
  export interface WorkerInput {
17
+ protocolToken: string;
17
18
  dbBuffer: Uint8Array | null;
18
19
  sql: string;
19
20
  options: {
@@ -73,9 +73,16 @@ export declare function isXzCompressed(data: Uint8Array): boolean;
73
73
  */
74
74
  export declare function createBzip2CompressedArchive(entries: TarCreateEntry[]): Promise<Uint8Array>;
75
75
  /**
76
- * Create an xz-compressed tar archive from entries
76
+ * Create an xz-compressed tar archive from entries.
77
+ *
78
+ * @param entries - Archive entries to include
79
+ * @param options - Options controlling compression behavior
80
+ * @param options.allowNativeCodecs - When false (default), rejects xz compression
81
+ * to avoid passing attacker-controlled bytes to native addons (node-liblzma).
77
82
  */
78
- export declare function createXzCompressedArchive(entries: TarCreateEntry[]): Promise<Uint8Array>;
83
+ export declare function createXzCompressedArchive(entries: TarCreateEntry[], options?: {
84
+ allowNativeCodecs?: boolean;
85
+ }): Promise<Uint8Array>;
79
86
  /**
80
87
  * Parse a bzip2-compressed tar archive
81
88
  */
@@ -102,9 +109,16 @@ export declare function parseXzCompressedArchive(data: Uint8Array, options?: {
102
109
  */
103
110
  export declare function isZstdCompressed(data: Uint8Array): boolean;
104
111
  /**
105
- * Create a zstd-compressed tar archive from entries
112
+ * Create a zstd-compressed tar archive from entries.
113
+ *
114
+ * @param entries - Archive entries to include
115
+ * @param options - Options controlling compression behavior
116
+ * @param options.allowNativeCodecs - When false (default), rejects zstd compression
117
+ * to avoid passing attacker-controlled bytes to native addons (@mongodb-js/zstd).
106
118
  */
107
- export declare function createZstdCompressedArchive(entries: TarCreateEntry[]): Promise<Uint8Array>;
119
+ export declare function createZstdCompressedArchive(entries: TarCreateEntry[], options?: {
120
+ allowNativeCodecs?: boolean;
121
+ }): Promise<Uint8Array>;
108
122
  /**
109
123
  * Parse a zstd-compressed tar archive.
110
124
  *
@@ -6,8 +6,6 @@ export interface FsData {
6
6
  export declare class InMemoryFs implements IFileSystem {
7
7
  private data;
8
8
  constructor(initialFiles?: InitialFiles);
9
- private normalizePath;
10
- private dirname;
11
9
  private ensureParentDirs;
12
10
  writeFileSync(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding, metadata?: {
13
11
  mode?: number;
@@ -33,7 +31,6 @@ export declare class InMemoryFs implements IFileSystem {
33
31
  exists(path: string): Promise<boolean>;
34
32
  stat(path: string): Promise<FsStat>;
35
33
  lstat(path: string): Promise<FsStat>;
36
- private resolveSymlink;
37
34
  /**
38
35
  * Resolve symlinks in intermediate path components only (not the final component).
39
36
  * Used by lstat which should not follow the final symlink.
@@ -70,10 +70,6 @@ export declare class MountableFs implements IFileSystem {
70
70
  * Validate that a mount point is allowed.
71
71
  */
72
72
  private validateMount;
73
- /**
74
- * Normalize a path to a consistent format.
75
- */
76
- private normalizePath;
77
73
  /**
78
74
  * Route a path to the appropriate filesystem.
79
75
  * Returns the filesystem and the relative path within that filesystem.
@@ -83,7 +83,6 @@ export declare class OverlayFs implements IFileSystem {
83
83
  * Returns null if the path is not under the mount point or would escape the root.
84
84
  */
85
85
  private toRealPath;
86
- private dirname;
87
86
  /**
88
87
  * Resolve a real-FS path to its canonical form and validate it stays
89
88
  * within the sandbox. Returns the canonical path for I/O, or null if
@@ -100,11 +99,6 @@ export declare class OverlayFs implements IFileSystem {
100
99
  * follow). Returns the canonical parent + basename for I/O, or null.
101
100
  */
102
101
  private resolveRealPathParent_;
103
- /**
104
- * Sanitize an error to prevent leaking real OS paths in error messages.
105
- * Node.js ErrnoException objects contain a `.path` property with the real
106
- * filesystem path — this must never reach the sandbox user.
107
- */
108
102
  private sanitizeError;
109
103
  private ensureParentDirs;
110
104
  /**
@@ -140,9 +134,14 @@ export declare class OverlayFs implements IFileSystem {
140
134
  readdir(path: string): Promise<string[]>;
141
135
  readdirWithFileTypes(path: string): Promise<DirentEntry[]>;
142
136
  rm(path: string, options?: RmOptions): Promise<void>;
137
+ /**
138
+ * Check (synchronously) whether a path exists on the real filesystem.
139
+ * Used to decide whether a tombstone is needed after deletion.
140
+ */
141
+ private existsOnRealFs;
143
142
  cp(src: string, dest: string, options?: CpOptions): Promise<void>;
144
143
  mv(src: string, dest: string): Promise<void>;
145
- resolvePath(base: string, path: string): string;
144
+ resolvePath(base: string, rel: string): string;
146
145
  getAllPaths(): string[];
147
146
  private scanRealFs;
148
147
  chmod(path: string, mode: number): Promise<void>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Pure path utilities for virtual filesystems.
3
+ *
4
+ * No node:fs or node:path dependencies — safe for browser bundles.
5
+ * Real-FS-backed implementations should import from real-fs-utils.ts
6
+ * (which re-exports these) to keep a single import source.
7
+ */
8
+ /** Maximum depth for symlink resolution loops. */
9
+ export declare const MAX_SYMLINK_DEPTH = 40;
10
+ /** Default directory permissions. */
11
+ export declare const DEFAULT_DIR_MODE = 493;
12
+ /** Default file permissions. */
13
+ export declare const DEFAULT_FILE_MODE = 420;
14
+ /** Default symlink permissions. */
15
+ export declare const SYMLINK_MODE = 511;
16
+ /**
17
+ * Normalize a virtual path: resolve `.` and `..`, ensure it starts with `/`,
18
+ * strip trailing slashes. Pure function, no I/O.
19
+ */
20
+ export declare function normalizePath(path: string): string;
21
+ /**
22
+ * Validate that a path does not contain null bytes.
23
+ * Null bytes in paths can be used to truncate filenames or bypass security
24
+ * filters.
25
+ */
26
+ export declare function validatePath(path: string, operation: string): void;
27
+ /**
28
+ * Get the directory name of a normalized virtual path.
29
+ */
30
+ export declare function dirname(path: string): string;
31
+ /**
32
+ * Resolve a relative path against a base directory.
33
+ * If `path` is absolute, it is normalized and returned directly.
34
+ */
35
+ export declare function resolvePath(base: string, path: string): string;
36
+ /**
37
+ * Join a parent path with a child name.
38
+ * Handles the root-path edge case (`"/" + "child"` → `"/child"`).
39
+ */
40
+ export declare function joinPath(parent: string, child: string): string;
41
+ /**
42
+ * Resolve a symlink target relative to the symlink's location.
43
+ * Absolute targets are normalized directly; relative targets are
44
+ * resolved from the symlink's parent directory.
45
+ */
46
+ export declare function resolveSymlinkTarget(symlinkPath: string, target: string): string;
@@ -70,10 +70,6 @@ export declare class ReadWriteFs implements IFileSystem {
70
70
  mv(src: string, dest: string): Promise<void>;
71
71
  resolvePath(base: string, path: string): string;
72
72
  getAllPaths(): string[];
73
- /**
74
- * Sanitize an error to prevent leaking real OS paths in error messages.
75
- * Replaces the original error with one containing only the virtual path.
76
- */
77
73
  private sanitizeError;
78
74
  /**
79
75
  * Recursively scan a directory for symlinks whose targets escape the sandbox.
@@ -4,12 +4,12 @@
4
4
  *
5
5
  * Security-critical path validation logic lives here so both implementations
6
6
  * stay consistent.
7
+ *
8
+ * Pure path utilities (normalizePath, validatePath, dirname, resolvePath, etc.)
9
+ * live in path-utils.ts (no node:fs dependency, browser-safe) and are
10
+ * re-exported here for convenience.
7
11
  */
8
- /**
9
- * Normalize a virtual path: resolve `.` and `..`, ensure it starts with `/`,
10
- * strip trailing slashes. Pure function, no I/O.
11
- */
12
- export declare function normalizePath(path: string): string;
12
+ export { normalizePath, validatePath } from "./path-utils.js";
13
13
  /**
14
14
  * Check whether `resolved` is equal to, or a child of, `canonicalRoot`.
15
15
  * Uses a boundary-safe prefix check (appends `/`) so that `/data` does not
@@ -57,12 +57,6 @@ export declare function resolveCanonicalPathNoSymlinks(realPath: string, root: s
57
57
  */
58
58
  export declare function validateRootDirectory(root: string, fsName: string): void;
59
59
  export { sanitizeErrorMessage } from "./sanitize-error.js";
60
- /**
61
- * Validate that a path does not contain null bytes.
62
- * Null bytes in paths can be used to truncate filenames or bypass security
63
- * filters.
64
- */
65
- export declare function validatePath(path: string, operation: string): void;
66
60
  /**
67
61
  * Sanitize a raw OS symlink target so it does not leak real filesystem paths
68
62
  * outside the sandbox.
@@ -82,3 +76,15 @@ export declare function sanitizeSymlinkTarget(rawTarget: string, canonicalRoot:
82
76
  withinRoot: false;
83
77
  safeName: string;
84
78
  };
79
+ /**
80
+ * Sanitize an error thrown during real-FS operations to prevent leaking
81
+ * real OS paths. Node.js ErrnoException objects contain a `.path` property
82
+ * with the real filesystem path — this must never reach the sandbox user.
83
+ *
84
+ * Errors whose `.path` is `undefined` are our own errors (constructed with
85
+ * `new Error(...)`) rather than Node.js ErrnoExceptions. If their message
86
+ * contains one of `passthroughPatterns`, they are rethrown as-is (they
87
+ * already contain safe virtual paths). All other errors are replaced with
88
+ * a generic `"CODE: operation 'virtualPath'"` message.
89
+ */
90
+ export declare function sanitizeFsError(e: unknown, virtualPath: string, operation: string, passthroughPatterns: readonly string[]): never;
package/dist/timers.d.ts CHANGED
@@ -2,6 +2,3 @@ export declare const _setTimeout: typeof globalThis.setTimeout;
2
2
  export declare const _clearTimeout: typeof globalThis.clearTimeout;
3
3
  export declare const _setInterval: typeof globalThis.setInterval;
4
4
  export declare const _clearInterval: typeof globalThis.clearInterval;
5
- export declare const _SharedArrayBuffer: typeof globalThis.SharedArrayBuffer;
6
- export declare const _Atomics: typeof globalThis.Atomics;
7
- export declare const _performanceNow: () => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "just-bash",
3
- "version": "2.12.4",
3
+ "version": "2.12.6",
4
4
  "description": "A simulated bash environment with virtual filesystem",
5
5
  "repository": {
6
6
  "type": "git",
@@ -102,10 +102,11 @@
102
102
  "build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:node:* --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs --define:__BROWSER__=true",
103
103
  "build:cli": "esbuild dist/cli/just-bash.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node' --external:sql.js --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
104
104
  "build:shell": "esbuild dist/cli/shell.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin/shell --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node' --external:sql.js --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
105
- "validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm test:run && pnpm test:python && pnpm test:dist && pnpm test:examples",
105
+ "validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm check:python-worker-sync && pnpm test:run && pnpm test:python && pnpm test:dist && pnpm test:examples",
106
106
  "test:examples": "cd examples/cjs-consumer && pnpm install --no-frozen-lockfile && npx tsc --noEmit",
107
107
  "typecheck": "tsc --noEmit",
108
108
  "lint": "biome check . && pnpm lint:banned",
109
+ "check:python-worker-sync": "node scripts/check-python-worker-sync.js",
109
110
  "lint:banned": "node scripts/check-banned-patterns.js",
110
111
  "lint:fix": "biome check --write .",
111
112
  "knip": "knip",
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as Y}from"./chunk-GIFF636B.js";import{a as ne}from"./chunk-4OALHZXB.js";import{a as te}from"./chunk-SE4C7FJY.js";import{a as oe,b as pe,c as ce}from"./chunk-D5WP4CKS.js";import{a as ie,b as le}from"./chunk-GTNBSMZR.js";function N(e,t){switch(e.type){case"name":{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let s=r[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,r=t.relativePath,s=n.split("/");for(let i=0;i<s.length-1;i++){let a=s[i];if(a&&a!=="."&&a!==".."&&!a.includes("*")&&!a.includes("?")&&!a.includes("[")){let p=`/${a}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let i=o[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:te(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let r=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=r>e.days:e.comparison==="less"?s=r<e.days:s=Math.floor(r)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let r;return e.comparison==="more"?r=t.size>n:e.comparison==="less"?r=t.size<n:e.unit==="b"?r=Math.ceil(t.size/512)===e.value:r=t.size===n,{matches:r,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,r=e.mode&511,s;return e.matchType==="exact"?s=n===r:e.matchType==="all"?s=(n&r)===r:s=(n&r)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=N(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=N(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=N(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case"or":{let n=N(e.left,t);if(n.matches)return n;let r=N(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function _(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right)}}function j(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return j(e.expr);case"and":case"or":return j(e.left)||j(e.right);default:return!1}}function fe(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=ve(e);if(Ee(e)&&n.length===1){let o=n[0].split("/").filter(i=>i.length>0);if(o.length>=2)for(let i=o.length-2;i>=0;i--){let a=o[i];if(!a.includes("*")&&!a.includes("?")&&!a.includes("[")&&a!=="."&&a!==".."){let p=o[i+1];if(p&&(p.includes("*")||p.includes("?"))){t.terminalDirName=a;let l=p.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function ve(e){let t=[],n=r=>{r.type==="path"?t.push(r.pattern):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right))};return n(e),t}function Ee(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function ue(e){let t=[],n=r=>{r&&(r.type==="newer"?t.push(r.refPath):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function H(e,t,n,r,s){switch(e.type){case"name":{let o=e.pattern,i=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(i){let a=i[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,i=o.split("/");for(let p=0;p<i.length-1;p++){let l=i[p];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let d=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(d))return{matches:!1,pruned:!1,printed:!1}}}let a=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let p=a[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(p))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:te(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:r,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let o=H(e.expr,t,n,r,s);return{matches:!o.matches,pruned:o.pruned,printed:!1}}case"and":{let o=H(e.left,t,n,r,s);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1};let i=H(e.right,t,n,r,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:o.printed||i.printed}}case"or":{let o=H(e.left,t,n,r,s);if(o.matches)return o;let i=H(e.right,t,n,r,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:i.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function V(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return V(e.expr);case"and":case"or":return V(e.left)||V(e.right);default:return!1}}function W(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return W(e.expr);case"and":case"or":return W(e.left)&&W(e.right)}}function he(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!W(e))return se(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:N(e,n).pruned}}function se(e,t){switch(e.type){case"or":{if(W(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(N(e.left,n).pruned)return{shouldPrune:!0}}return se(e.right,t)}case"and":{if(W(e.left)&&W(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:N(e,n).pruned}}if(W(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return N(e.left,n).matches?se(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function de(e,t){let n=[],r=[],s=t;for(;s<e.length;){let i=e[s];if(i==="("||i==="\\("){n.push({type:"lparen"}),s++;continue}if(i===")"||i==="\\)"){n.push({type:"rparen"}),s++;continue}if(i==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(i==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(i==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(i==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(i==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(i==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(i==="-type"&&s+1<e.length){let a=e[++s];if(a==="f"||a==="d")n.push({type:"expr",expr:{type:"type",fileType:a}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${a}
3
- `,actions:[]}}else if(i==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(i==="-mtime"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("+")?(p="more",l=a.slice(1)):a.startsWith("-")&&(p="less",l=a.slice(1));let d=parseInt(l,10);Number.isNaN(d)||n.push({type:"expr",expr:{type:"mtime",days:d,comparison:p}})}else if(i==="-newer"&&s+1<e.length){let a=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:a}})}else if(i==="-size"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("+")?(p="more",l=a.slice(1)):a.startsWith("-")&&(p="less",l=a.slice(1));let d=l.match(/^(\d+)([ckMGb])?$/);if(d){let B=parseInt(d[1],10),I=d[2]||"b";n.push({type:"expr",expr:{type:"size",value:B,unit:I,comparison:p}})}}else if(i==="-perm"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("-")?(p="all",l=a.slice(1)):a.startsWith("/")&&(p="any",l=a.slice(1));let d=parseInt(l,8);Number.isNaN(d)||n.push({type:"expr",expr:{type:"perm",mode:d,matchType:p}})}else if(i==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(i==="-not"||i==="!")n.push({type:"not"});else if(i==="-o"||i==="-or")n.push({type:"op",op:"or"});else if(i==="-a"||i==="-and")n.push({type:"op",op:"and"});else if(i==="-maxdepth"||i==="-mindepth")s++;else if(i!=="-depth")if(i==="-exec"){let a=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)a.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let p=e[s]==="+";r.push({type:"exec",command:a,batchMode:p})}else if(i==="-print")n.push({type:"expr",expr:{type:"print"}}),r.push({type:"print"});else if(i==="-print0")r.push({type:"print0"});else if(i==="-printf"&&s+1<e.length){let a=e[++s];r.push({type:"printf",format:a})}else if(i==="-delete")r.push({type:"delete"});else{if(i.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${i}'
4
- `,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:r};let o=Me(n);return o.error?{expr:null,pathIndex:s,error:o.error,actions:r}:{expr:o.expr,pathIndex:s,actions:r}}function Me(e){let t=0;function n(){let a=r();if(!a)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="or"){t++;let l=r();if(!l)return a;a={type:"or",left:a,right:l}}else break}return a}function r(){let a=s();if(!a)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="and"){t++;let l=s();if(!l)return a;a={type:"and",left:a,right:l}}else if(p.type==="expr"||p.type==="not"||p.type==="lparen"){let l=s();if(!l)return a;a={type:"and",left:a,right:l}}else break}return a}function s(){if(t<e.length&&e[t].type==="not"){t++;let a=s();return a?{type:"not",expr:a}:null}return o()}function o(){if(t>=e.length)return null;let a=e[t];if(a.type==="lparen"){t++;let p=n();return t<e.length&&e[t].type==="rparen"&&t++,p}return a.type==="expr"?(t++,a.expr):(a.type==="rparen",null)}return{expr:n()}}var me=500;function xe(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function Fe(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var Ie={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},$e=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),_e={name:"find",async execute(e,t){if(le(e))return ie(Ie);let n=[],r=null,s=null,o=!1,i=!1;for(let c=0;c<e.length;c++){let f=e[c];if(f==="-maxdepth"&&c+1<e.length)i=!0,r=parseInt(e[++c],10);else if(f==="-mindepth"&&c+1<e.length)i=!0,s=parseInt(e[++c],10);else if(f==="-depth")i=!0,o=!0;else if(f==="-exec")for(i=!0,c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else!f.startsWith("-")&&f!==";"&&f!=="+"&&f!=="("&&f!==")"&&f!=="\\("&&f!=="\\)"&&f!=="!"?i||n.push(f):$e.has(f)?(i=!0,c++):(f.startsWith("-")||f==="("||f==="\\("||f==="!")&&(i=!0)}n.length===0&&n.push(".");let{expr:a,error:p,actions:l}=de(e,0);if(p)return{stdout:"",stderr:p,exitCode:1};let d=l.some(c=>c.type==="print"),B=l.length===0,I=[],ye=l.some(c=>c.type==="printf"),re=[],q="",G=0,ge=ue(a),U=new Map;for(let c of ge){let f=t.fs.resolvePath(t.cwd,c);try{let h=await t.fs.stat(f);U.set(c,h.mtime?.getTime()??Date.now())}catch{}}let we=l.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),De=_(a)||we,Te=j(a),K=fe(a),ae=V(a),Ce=J(a),Pe=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let z=function(u){let R=s===null||u.depth>=s,P=!1;if(R&&a!==null){let S=Date.now(),y;if(Ce)y=H(a,u.name,u.relativePath,u.isFile,u.isDirectory);else{let m={name:u.name,relativePath:u.relativePath,isFile:u.isFile,isDirectory:u.isDirectory,isEmpty:u.isEmpty,mtime:u.stat?.mtime?.getTime()??Date.now(),size:u.stat?.size??0,mode:u.stat?.mode??420,newerRefTimes:U};y=N(a,m)}R=y.matches,P=d?y.printed:R,h.evalCalls++,h.evalTime+=Date.now()-S}else R&&(P=!0);return P?{print:!0,printfData:ye?{path:u.relativePath,name:u.name,size:u.stat?.size??0,mtime:u.stat?.mtime?.getTime()??Date.now(),mode:u.stat?.mode??420,isDirectory:u.isDirectory,depth:u.depth,startingPoint:c}:null}:{print:!1,printfData:null}};var We=z;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{q+=`find: ${c}: No such file or directory
5
- `,G=1;continue}let h=xe(),$=Date.now();async function v(u){let{path:b,depth:R,typeInfo:P}=u;if(h.nodeCount++,R>(r??256))return null;let E,S,y;if(P&&!De)E=P.isFile,S=P.isDirectory;else{try{let L=Date.now();y=await t.fs.stat(b),h.statCalls++,h.statTime+=Date.now()-L}catch{return null}if(!y)return null;E=y.isFile,S=y.isDirectory}let m;b===f?m=c.split("/").pop()||c:m=b.split("/").pop()||"";let g=b===f?c:c==="."?`./${b.slice(f==="/"?f.length:f.length+1)}`:c+b.slice(f.length),T=[],C=null,w=null,D=!1;S&&ae&&!o&&(D=he(a,{name:m,relativePath:g,isFile:E,isDirectory:S}).shouldPrune,D&&h.earlyPrunes++);let x=R>=(r??256),F=K.terminalDirName!==null&&m===K.terminalDirName,Z=!x&&!F&&!D;if(S&&((Z||Te||F)&&!D)){let L=Date.now();if(Pe&&t.fs.readdirWithFileTypes){if(C=await t.fs.readdirWithFileTypes(b),w=C.map(M=>M.name),h.readdirCalls++,h.readdirTime+=Date.now()-L,Z)T=C.map((M,k)=>({path:b==="/"?`/${M.name}`:`${b}/${M.name}`,depth:R+1,typeInfo:{isFile:M.isFile,isDirectory:M.isDirectory},resultIndex:k}));else if(F){let M=K.requiredExtension;T=C.filter(k=>k.isFile&&(!M||k.name.endsWith(M))).map((k,be)=>({path:b==="/"?`/${k.name}`:`${b}/${k.name}`,depth:R+1,typeInfo:{isFile:k.isFile,isDirectory:k.isDirectory},resultIndex:be}))}}else w=await t.fs.readdir(b),h.readdirCalls++,h.readdirTime+=Date.now()-L,Z&&(T=w.map((M,k)=>({path:b==="/"?`/${M}`:`${b}/${M}`,depth:R+1,resultIndex:k})))}let Q=E?(y?.size??0)===0:w!==null&&w.length===0,O=D;if(!o&&a!==null&&!D&&ae){let L=Date.now(),M={name:m,relativePath:g,isFile:E,isDirectory:S,isEmpty:Q,mtime:y?.mtime?.getTime()??Date.now(),size:y?.size??0,mode:y?.mode??420,newerRefTimes:U};O=N(a,M).pruned,h.evalCalls++,h.evalTime+=Date.now()-L}return{relativePath:g,name:m,isFile:E,isDirectory:S,isEmpty:Q,stat:y,depth:R,children:O?[]:T,pruned:O}}async function Se(){let u={paths:[],printfData:[]};if(o){let y=function(m){let g={paths:[],printfData:[]},T=P[m];if(!T)return g;for(let D of T.childIndices){let x=y(D);g.paths.push(...x.paths),g.printfData.push(...x.printfData)}let{print:C,printfData:w}=z(T.node);return C&&(g.paths.push(T.node.relativePath),w&&g.printfData.push(w)),g};var b=y;let P=[],E=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map;for(;E.length>0;){let m=Date.now(),g=E.splice(0,me),T=await Promise.all(g.map(C=>v(C.item)));h.batchCount++,h.batchTime+=Date.now()-m;for(let C=0;C<g.length;C++){let w=T[C],D=g[C];if(!w)continue;let x=P.length;if(D.parentIndex>=0){let F=S.get(D.parentIndex)||[];F.push(x),S.set(D.parentIndex,F)}P.push({node:w,parentIndex:D.parentIndex,childIndices:[]});for(let F=0;F<w.children.length;F++)E.push({item:w.children[F],parentIndex:x,childOrderInParent:F})}}for(let[m,g]of S)m>=0&&m<P.length&&(P[m].childIndices=g);if(P.length>0){let m=y(0);u.paths.push(...m.paths),u.printfData.push(...m.printfData)}}else{let m=function(g){let T=P.get(g);T&&(u.paths.push(T.path),T.printfData&&u.printfData.push(T.printfData));let C=y.get(g);if(C)for(let w of C)m(w)};var R=m;let P=new Map,E=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:E++}],y=new Map;for(;S.length>0;){let g=Date.now(),T=S.splice(0,me),C=await Promise.all(T.map(async({item:w,orderIndex:D})=>{let x=await v(w);return x?{node:x,orderIndex:D}:null}));h.batchCount++,h.batchTime+=Date.now()-g;for(let w of C){if(!w)continue;let{node:D,orderIndex:x}=w,{print:F,printfData:Z}=z(D);if(F&&P.set(x,{path:D.relativePath,printfData:Z}),D.children.length>0){let ee=[];for(let Q of D.children){let O=E++;ee.push(O),S.push({item:Q,orderIndex:O})}y.set(x,ee)}}}m(0)}return u}let X=await Se();if(I.push(...X.paths),re.push(...X.printfData),t.trace){let u=Date.now()-$;Fe(t.trace,h,u),t.trace({category:"find",name:"searchPath",durationMs:u,details:{path:c,resultsFound:X.paths.length}})}}let A="";if(l.length>0)for(let c of l)switch(c.type){case"print":A+=I.length>0?`${I.join(`
6
- `)}
7
- `:"";break;case"print0":A+=I.length>0?`${I.join("\0")}\0`:"";break;case"delete":{let f=[...I].sort((h,$)=>$.length-h.length);for(let h of f){let $=t.fs.resolvePath(t.cwd,h);try{await t.fs.rm($,{recursive:!1})}catch(v){let z=v instanceof Error?v.message:String(v);q+=`find: cannot delete '${h}': ${z}
8
- `,G=1}}break}case"printf":for(let f of re)A+=Re(c.format,f);break;case"exec":if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
9
- `,exitCode:1};if(c.batchMode){let f=[];for(let v of c.command)v==="{}"?f.push(...I):f.push(v);let h=ne(f),$=await t.exec(h,{cwd:t.cwd,signal:t.signal});A+=$.stdout,q+=$.stderr,$.exitCode!==0&&(G=$.exitCode)}else for(let f of I){let h=c.command.map(z=>z==="{}"?f:z),$=ne(h),v=await t.exec($,{cwd:t.cwd,signal:t.signal});A+=v.stdout,q+=v.stderr,v.exitCode!==0&&(G=v.exitCode)}break}else B&&(A=I.length>0?`${I.join(`
10
- `)}
11
- `:"");return{stdout:A,stderr:q,exitCode:G}}};function Re(e,t){let n=ce(e),r="",s=0;for(;s<n.length;)if(n[s]==="%"&&s+1<n.length){if(s++,n[s]==="%"){r+="%",s++;continue}let[o,i,a]=pe(n,s);if(s+=a,s>=n.length){r+="%";break}let p=n[s],l;switch(p){case"f":l=t.name,s++;break;case"h":{let d=t.path.lastIndexOf("/");l=d>0?t.path.slice(0,d):".",s++;break}case"p":l=t.path,s++;break;case"P":{let d=t.startingPoint;t.path===d?l="":t.path.startsWith(`${d}/`)?l=t.path.slice(d.length+1):d==="."&&t.path.startsWith("./")?l=t.path.slice(2):l=t.path,s++;break}case"s":l=String(t.size),s++;break;case"d":l=String(t.depth),s++;break;case"m":l=(t.mode&511).toString(8),s++;break;case"M":l=ke(t.mode,t.isDirectory),s++;break;case"t":{let d=new Date(t.mtime);l=Ne(d),s++;break}case"T":{if(s+1<n.length){let d=n[s+1],B=new Date(t.mtime);l=ze(B,d),s+=2}else l="%T",s++;break}default:r+=`%${o!==0||i!==-1?`${o}.${i}`:""}${p}`,s++;continue}r+=oe(l,o,i)}else r+=n[s],s++;return r}function ke(e,t){let n=e&511,r=t?"d":"-";return r+=n&256?"r":"-",r+=n&128?"w":"-",r+=n&64?"x":"-",r+=n&32?"r":"-",r+=n&16?"w":"-",r+=n&8?"x":"-",r+=n&4?"r":"-",r+=n&2?"w":"-",r+=n&1?"x":"-",r}function Ne(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=t[e.getDay()],s=n[e.getMonth()],o=String(e.getDate()).padStart(2," "),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),p=String(e.getSeconds()).padStart(2,"0"),l=e.getFullYear();return`${r} ${s} ${o} ${i}:${a}:${p} ${l}`}function ze(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var je={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0};export{_e as a,je as b};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import*as o from"node:fs";import*as r from"node:path";function y(t){if(!t||t==="/")return"/";let e=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;e.startsWith("/")||(e=`/${e}`);let n=e.split("/").filter(i=>i&&i!=="."),s=[];for(let i of n)i===".."?s.pop():s.push(i);return`/${s.join("/")}`||"/"}function u(t,e){return t===e||t.startsWith(`${e}/`)}function a(t,e){try{let n=o.realpathSync(t);return u(n,e)?n:null}catch(n){if(n.code==="ENOENT"){let s=r.dirname(t);if(s===t)return null;let i=a(s,e);if(i===null)return null;try{if(o.lstatSync(t).isSymbolicLink()){let l=o.readlinkSync(t),f=r.isAbsolute(l)?l:r.resolve(r.dirname(t),l);if(a(f,e)===null)return null}}catch{}return r.join(i,r.basename(t))}return null}}function m(t,e,n){let s=a(t,n);if(s===null)return null;let i=r.resolve(t),c=i.slice(e.length),l=s.slice(n.length);if(c!==l)return null;try{if(o.lstatSync(i).isSymbolicLink())return null}catch{}return s}function v(t,e){if(!o.existsSync(t))throw new Error(`${e} root does not exist`);if(!o.statSync(t).isDirectory())throw new Error(`${e} root is not a directory`)}function p(t,e){if(t.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${e} '${t}'`)}function S(t,e){if(!r.isAbsolute(t))return{withinRoot:!0,relativePath:t};let n;try{n=o.realpathSync(t)}catch{n=r.resolve(t)}return u(n,e)?{withinRoot:!0,relativePath:n.slice(e.length)||"/"}:{withinRoot:!1,safeName:r.basename(t)}}export{y as a,u as b,a as c,m as d,v as e,p as f,S as g};
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as x,b as w}from"./chunk-WMYKQURM.js";import{c as b}from"./chunk-WO4B7WUT.js";import{b as E}from"./chunk-EO5AH4U7.js";import{a as m}from"./chunk-SYG3IW7P.js";import{a as T,b as C}from"./chunk-GTNBSMZR.js";import{existsSync as k}from"node:fs";import{dirname as _,join as q}from"node:path";import{fileURLToPath as z}from"node:url";import{Worker as X}from"node:worker_threads";import Y from"sql.js";function V(e,r,n){switch(n.mode){case"list":return B(e,r,n);case"csv":return O(e,r,n);case"json":return N(e,r);case"line":return P(e,r,n);case"column":return R(e,r,n);case"table":return F(e,r,n);case"markdown":return Q(e,r,n);case"tabs":return U(e,r,n);case"box":return D(e,r,n);case"quote":return W(e,r,n);case"html":return H(e,r,n);case"ascii":return J(e,r,n)}}function f(e,r){return e==null?r:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString("utf8"):typeof e=="number"&&!Number.isInteger(e)?e.toPrecision(17).replace(/\.?0+$/,""):String(e)}function B(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.join(n.separator));for(let a of r)t.push(a.map(o=>f(o,n.nullValue)).join(n.separator));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function O(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.map(L).join(","));for(let a of r)t.push(a.map(o=>L(f(o,n.nullValue))).join(","));return t.length>0?`${t.join(`
3
- `)}
4
- `:""}function L(e){return e.includes(",")||e.includes('"')||e.includes("'")||e.includes(`
5
- `)?`"${e.replace(/"/g,'""')}"`:e}function A(e){return e.toPrecision(17).replace(/\.?0+$/,"")}function I(e){return e===null?"null":typeof e=="number"?Number.isInteger(e)?String(e):A(e):JSON.stringify(e)}function N(e,r){return r.length===0?"":`[${r.map(t=>`{${e.map((o,i)=>`${JSON.stringify(o)}:${I(t[i])}`).join(",")}}`).join(`,
6
- `)}]
7
- `}function P(e,r,n){if(e.length===0||r.length===0)return"";let t=Math.max(5,...e.map(o=>o.length)),a=[];for(let o of r)for(let i=0;i<e.length;i++){let s=e[i].padStart(t);a.push(`${s} = ${f(o[i],n.nullValue)}`)}return`${a.join(`
8
- `)}
9
- `}function R(e,r,n){if(e.length===0)return"";let t=e.map(o=>o.length);for(let o of r)for(let i=0;i<o.length;i++){let s=f(o[i],n.nullValue).length;s>t[i]&&(t[i]=s)}let a=[];n.header&&(a.push(e.map((o,i)=>o.padEnd(t[i])).join(" ")),a.push(t.map(o=>"-".repeat(o)).join(" ")));for(let o of r)a.push(o.map((i,s)=>f(i,n.nullValue).padEnd(t[s])).join(" "));return a.length>0?`${a.join(`
10
- `)}
11
- `:""}function F(e,r,n){if(e.length===0)return"";let t=e.map(i=>i.length);for(let i of r)for(let s=0;s<i.length;s++){let h=f(i[s],n.nullValue).length;h>t[s]&&(t[s]=h)}let a=[],o=`+${t.map(i=>"-".repeat(i+2)).join("+")}+`;a.push(o),n.header&&(a.push(`| ${e.map((i,s)=>i.padEnd(t[s])).join(" | ")} |`),a.push(o));for(let i of r)a.push(`| ${i.map((s,h)=>f(s,n.nullValue).padEnd(t[h])).join(" | ")} |`);return a.push(o),`${a.join(`
12
- `)}
13
- `}function Q(e,r,n){if(e.length===0)return"";let t=[];n.header&&(t.push(`| ${e.join(" | ")} |`),t.push(`|${e.map(()=>"---").join("|")}|`));for(let a of r)t.push(`| ${a.map(o=>f(o,n.nullValue)).join(" | ")} |`);return t.length>0?`${t.join(`
14
- `)}
15
- `:""}function U(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.join(" "));for(let a of r)t.push(a.map(o=>f(o,n.nullValue)).join(" "));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function D(e,r,n){if(e.length===0)return"";let t=e.map(o=>o.length);for(let o of r)for(let i=0;i<o.length;i++){let s=f(o[i],n.nullValue).length;s>t[i]&&(t[i]=s)}let a=[];a.push(`\u250C${t.map(o=>"\u2500".repeat(o+2)).join("\u252C")}\u2510`),a.push(`\u2502 ${e.map((o,i)=>o.padEnd(t[i])).join(" \u2502 ")} \u2502`),a.push(`\u251C${t.map(o=>"\u2500".repeat(o+2)).join("\u253C")}\u2524`);for(let o of r)a.push(`\u2502 ${o.map((i,s)=>f(i,n.nullValue).padEnd(t[s])).join(" \u2502 ")} \u2502`);return a.push(`\u2514${t.map(o=>"\u2500".repeat(o+2)).join("\u2534")}\u2518`),`${a.join(`
16
- `)}
17
- `}function W(e,r,n){let t=[];n.header&&e.length>0&&t.push(e.map(a=>`'${a}'`).join(","));for(let a of r)t.push(a.map(o=>o==null?"NULL":typeof o=="number"?Number.isInteger(o)?String(o):A(o):`'${String(o)}'`).join(","));return t.length>0?`${t.join(n.newline)}${n.newline}`:""}function H(e,r,n){let t=[];n.header&&e.length>0&&(t.push(`<TR>${e.map(a=>`<TH>${M(a)}</TH>`).join("")}`),t.push("</TR>"));for(let a of r)t.push(`<TR>${a.map(o=>`<TD>${M(f(o,n.nullValue))}</TD>`).join("")}`),t.push("</TR>");return t.length>0?`${t.join(`
18
- `)}
19
- `:""}function M(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function J(e,r,n){let o=[];n.header&&e.length>0&&o.push(e.join(""));for(let i of r)o.push(i.map(s=>f(s,n.nullValue)).join(""));return o.length>0?o.join("")+"":""}var G=5e3,K={name:"sqlite3",summary:"SQLite database CLI",usage:"sqlite3 [OPTIONS] DATABASE [SQL]",options:["-list output in list mode (default)","-csv output in CSV mode","-json output in JSON mode","-line output in line mode","-column output in column mode","-table output as ASCII table","-markdown output as markdown table","-tabs output in tab-separated mode","-box output in Unicode box mode","-quote output in SQL quote mode","-html output as HTML table","-ascii output in ASCII mode (control chars)","-header show column headers","-noheader hide column headers","-separator SEP field separator for list mode (default: |)","-newline SEP row separator (default: \\n)","-nullvalue TEXT text for NULL values (default: empty)","-readonly open database read-only (no writeback)","-bail stop on first error","-echo print SQL before execution","-cmd COMMAND run SQL command before main SQL","-version show SQLite version","-- end of options","--help show this help"],examples:['sqlite3 :memory: "CREATE TABLE t(x); INSERT INTO t VALUES(1); SELECT * FROM t"','sqlite3 -json data.db "SELECT * FROM users"','sqlite3 -csv -header data.db "SELECT id, name FROM products"','sqlite3 -box data.db "SELECT * FROM users"']};function Z(e){let r={mode:"list",header:!1,separator:"|",newline:`
20
- `,nullValue:"",readonly:!1,bail:!1,echo:!1,cmd:null},n=null,t=null,a=!1,o=!1;for(let i=0;i<e.length;i++){let s=e[i];if(o){n===null?n=s:t===null&&(t=s);continue}if(s==="--")o=!0;else if(s==="-version")a=!0;else if(s==="-list")r.mode="list";else if(s==="-csv")r.mode="csv";else if(s==="-json")r.mode="json";else if(s==="-line")r.mode="line";else if(s==="-column")r.mode="column";else if(s==="-table")r.mode="table";else if(s==="-markdown")r.mode="markdown";else if(s==="-tabs")r.mode="tabs";else if(s==="-box")r.mode="box";else if(s==="-quote")r.mode="quote";else if(s==="-html")r.mode="html";else if(s==="-ascii")r.mode="ascii";else if(s==="-header")r.header=!0;else if(s==="-noheader")r.header=!1;else if(s==="-readonly")r.readonly=!0;else if(s==="-bail")r.bail=!0;else if(s==="-echo")r.echo=!0;else if(s==="-separator"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -separator
21
- `,exitCode:1};r.separator=e[++i]}else if(s==="-newline"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -newline
22
- `,exitCode:1};r.newline=e[++i]}else if(s==="-nullvalue"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -nullvalue
23
- `,exitCode:1};r.nullValue=e[++i]}else if(s==="-cmd"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -cmd
24
- `,exitCode:1};r.cmd=e[++i]}else{if(s.startsWith("-"))return{stdout:"",stderr:`sqlite3: Error: unknown option: ${s.startsWith("--")?s.slice(1):s}
25
- Use -help for a list of options.
26
- `,exitCode:1};n===null?n=s:t===null&&(t=s)}}return{options:r,database:n,sql:t,showVersion:a}}async function v(){let e=await E.runTrustedAsync(()=>Y()),r=new e.Database;try{let n=r.exec("SELECT sqlite_version()");return n.length>0&&n[0].values.length>0?String(n[0].values[0][0]):"unknown"}finally{r.close()}}function ee(){let e=_(z(import.meta.url)),r=q(e,"../../commands/sqlite3/worker.js");if(k(r))return r;let n=q(e,"worker.js");if(k(n))return n;let t=q(e,"../../../dist/commands/sqlite3/worker.js");if(k(t))return t;throw new Error("sqlite3 worker not found. Run 'pnpm build' to compile the worker.")}var re={createWorker(e,r){return new X(e,{workerData:r})}};function te(e){if(!e||typeof e!="object")return{success:!1,error:"Malformed worker response"};let r=e;return r.type==="security-violation"?{success:!1,error:`Security violation: ${typeof r.violation?.type=="string"?r.violation.type:"unknown"}`}:typeof r.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:r.success?Array.isArray(r.results)?typeof r.hasModifications!="boolean"?{success:!1,error:"Malformed worker response: missing hasModifications flag"}:r.dbBuffer!==null&&r.dbBuffer!==void 0&&!(r.dbBuffer instanceof Uint8Array)?{success:!1,error:"Malformed worker response: invalid dbBuffer"}:{success:!0,results:r.results,hasModifications:r.hasModifications,dbBuffer:r.dbBuffer===void 0?null:r.dbBuffer,defenseStats:r.defenseStats}:{success:!1,error:"Malformed worker response: missing results array"}:{success:!1,error:typeof r.error=="string"&&r.error.length>0?r.error:"Worker execution failed"}}async function ne(e,r,n){try{let t=ee();return await new Promise((a,o)=>{let i=E.runTrusted(()=>re.createWorker(t,e)),s=b(n,"sqlite3","worker timeout callback",()=>{i.terminate(),a({success:!1,error:`Query timeout: execution exceeded ${r}ms limit`})}),c=x(()=>{try{s()}catch(u){let l=u instanceof Error?u.message:String(u);a({success:!1,error:m(l)})}},r),S=b(n,"sqlite3","worker message callback",u=>{w(c),a(te(u))}),$=b(n,"sqlite3","worker error callback",u=>{w(c),o(u)}),j=b(n,"sqlite3","worker exit callback",u=>{w(c),u!==0&&a({success:!1,error:`Worker exited with code ${u}`})}),p=u=>{try{S(u)}catch(l){w(c);let d=l instanceof Error?l.message:String(l);a({success:!1,error:m(d)})}},y=u=>{try{$(u)}catch(l){w(c);let d=l instanceof Error?l.message:String(l);o(new Error(m(d)))}},g=u=>{try{j(u)}catch(l){w(c);let d=l instanceof Error?l.message:String(l);a({success:!1,error:m(d)})}};i.on("message",p),i.on("error",y),i.on("exit",g)})}catch(t){let a=m(t.message);throw new Error(`sqlite3 worker failed to load: ${a}`)}}var ge={name:"sqlite3",async execute(e,r){if(C(e)||e.includes("-help"))return T(K);let n=Z(e);if("exitCode"in n)return n;let{options:t,database:a,sql:o,showVersion:i}=n;if(i)return{stdout:`${await v()}
27
- `,stderr:"",exitCode:0};if(!a)return{stdout:"",stderr:`sqlite3: missing database argument
28
- `,exitCode:1};let s=o||r.stdin.trim();if(t.cmd&&(s=t.cmd+(s?`; ${s}`:"")),!s)return{stdout:"",stderr:`sqlite3: no SQL provided
29
- `,exitCode:1};let h=a===":memory:",c="",S=null;try{h||(c=r.fs.resolvePath(r.cwd,a),await r.fs.exists(c)&&(S=await r.fs.readFileBuffer(c)))}catch(l){let d=m(l.message);return{stdout:"",stderr:`sqlite3: unable to open database "${a}": ${d}
30
- `,exitCode:1}}let $=r.limits?.maxSqliteTimeoutMs??G,j={dbBuffer:S,sql:s,options:{bail:t.bail,echo:t.echo}},p;try{p=await ne(j,$,r.requireDefenseContext)}catch(l){return{stdout:"",stderr:`sqlite3: worker error: ${m(l.message)}
31
- `,exitCode:1}}if(!p.success)return{stdout:"",stderr:`sqlite3: ${m(p.error)}
32
- `,exitCode:1};let y={mode:t.mode,header:t.header,separator:t.separator,newline:t.newline,nullValue:t.nullValue},g="";t.echo&&(g+=`${s}
33
- `);let u=!1;for(let l of p.results)if(l.type==="error"){if(t.bail)return{stdout:g,stderr:`Error: ${l.error}
34
- `,exitCode:1};g+=`Error: ${l.error}
35
- `,u=!0}else l.columns&&l.rows&&(l.rows.length>0||t.header)&&(g+=V(l.columns,l.rows,y));if(p.hasModifications&&!t.readonly&&!h&&c&&p.dbBuffer)try{await r.fs.writeFile(c,p.dbBuffer)}catch(l){let d=m(l.message);return{stdout:g,stderr:`sqlite3: failed to write database: ${d}
36
- `,exitCode:1}}return{stdout:g,stderr:"",exitCode:u&&t.bail?1:0}}},we={name:"sqlite3",flags:[],needsArgs:!0};export{re as a,ge as b,we as c};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as w,b as v}from"./chunk-GTNBSMZR.js";var C={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},R={name:"chmod",async execute(s,a){if(v(s))return w(C);if(s.length<2)return{stdout:"",stderr:`chmod: missing operand
3
- `,exitCode:1};let e=!1,c=!1,o=0;for(;o<s.length&&s[o].startsWith("-");){let t=s[o];if(t==="-R"||t==="--recursive")e=!0,o++;else if(t==="-v"||t==="--verbose")c=!0,o++;else if(t==="--"){o++;break}else{if(/^[+-]?[rwxugo]+/.test(t)||/^\d+$/.test(t))break;if(/^-[Rv]+$/.test(t)){t.includes("R")&&(e=!0),t.includes("v")&&(c=!0),o++;continue}return{stdout:"",stderr:`chmod: invalid option -- '${t.slice(1)}'
4
- `,exitCode:1}}}if(s.length-o<2)return{stdout:"",stderr:`chmod: missing operand
5
- `,exitCode:1};let n=s[o],l=s.slice(o+1),r=/^[0-7]+$/.test(n),i;if(r)i=parseInt(n,8);else try{p(n,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${n}'
6
- `,exitCode:1}}let f="",d="",u=!1;for(let t of l){let h=a.fs.resolvePath(a.cwd,t);try{let m;if(r&&i!==void 0)m=i;else{let g=await a.fs.stat(h);m=p(n,g.mode)}if(await a.fs.chmod(h,m),c&&(f+=`mode of '${t}' changed to ${m.toString(8).padStart(4,"0")}
7
- `),e&&(await a.fs.stat(h)).isDirectory){let y=await $(a,h,r?i:void 0,r?void 0:n,c);f+=y}}catch{d+=`chmod: cannot access '${t}': No such file or directory
8
- `,u=!0}}return{stdout:f,stderr:d,exitCode:u?1:0}}};async function $(s,a,e,c,o){let n="",l=await s.fs.readdir(a);for(let r of l){let i=a==="/"?`/${r}`:`${a}/${r}`,f;if(e!==void 0)f=e;else if(c!==void 0){let u=await s.fs.stat(i);f=p(c,u.mode)}else f=420;await s.fs.chmod(i,f),o&&(n+=`mode of '${i}' changed to ${f.toString(8).padStart(4,"0")}
9
- `),(await s.fs.stat(i)).isDirectory&&(n+=await $(s,i,e,c,o))}return n}function p(s,a=420){if(/^[0-7]+$/.test(s))return parseInt(s,8);let e=a&4095,c=s.split(",");for(let o of c){let n=o.match(/^([ugoa]*)([+\-=])([rwxXst]*)$/);if(!n)throw new Error(`Invalid mode: ${s}`);let l=n[1]||"a",r=n[2],i=n[3];(l==="a"||l==="")&&(l="ugo");let f=0;i.includes("r")&&(f|=4),i.includes("w")&&(f|=2),(i.includes("x")||i.includes("X"))&&(f|=1);let d=0;i.includes("s")&&(l.includes("u")&&(d|=2048),l.includes("g")&&(d|=1024)),i.includes("t")&&(d|=512);for(let u of l){let t=0;u==="u"?t=6:u==="g"?t=3:u==="o"&&(t=0);let h=f<<t;r==="+"?e|=h:r==="-"?e&=~h:r==="="&&(e&=~(7<<t),e|=h)}r==="+"?e|=d:r==="-"?e&=~d:r==="="&&(i.includes("s")&&(l.includes("u")&&(e&=-2049,e|=d&2048),l.includes("g")&&(e&=-1025,e|=d&1024)),i.includes("t")&&(e&=-513,e|=d&512))}return e}var b={name:"chmod",flags:[{flag:"-R",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{R as a,b};
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as h}from"./chunk-SYG3IW7P.js";import{a as m,b as g}from"./chunk-GTNBSMZR.js";var p={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},v={name:"ln",async execute(i,s){if(g(i))return m(p);let r=!1,a=!1,f=!1,t=0;for(;t<i.length&&i[t].startsWith("-");){let e=i[t];if(e==="-s"||e==="--symbolic")r=!0,t++;else if(e==="-f"||e==="--force")a=!0,t++;else if(e==="-v"||e==="--verbose")f=!0,t++;else if(e==="-n"||e==="--no-dereference")t++;else if(/^-[sfvn]+$/.test(e))e.includes("s")&&(r=!0),e.includes("f")&&(a=!0),e.includes("v")&&(f=!0),t++;else if(e==="--"){t++;break}else return{stdout:"",stderr:`ln: invalid option -- '${e.slice(1)}'
3
- `,exitCode:1}}let d=i.slice(t);if(d.length<2)return{stdout:"",stderr:`ln: missing file operand
4
- `,exitCode:1};let n=d[0],l=d[1],o=s.fs.resolvePath(s.cwd,l);if(await s.fs.exists(o))if(a)try{await s.fs.rm(o,{force:!0})}catch{return{stdout:"",stderr:`ln: cannot remove '${l}': Permission denied
5
- `,exitCode:1}}else return{stdout:"",stderr:`ln: failed to create ${r?"symbolic ":""}link '${l}': File exists
6
- `,exitCode:1};try{if(r)await s.fs.symlink(n,o);else{let e=s.fs.resolvePath(s.cwd,n);if(!await s.fs.exists(e))return{stdout:"",stderr:`ln: failed to access '${n}': No such file or directory
7
- `,exitCode:1};await s.fs.link(e,o)}}catch(e){let u=e;return u.message.includes("EPERM")?{stdout:"",stderr:`ln: '${n}': hard link not allowed for directory
8
- `,exitCode:1}:{stdout:"",stderr:`ln: ${h(u.message)}
9
- `,exitCode:1}}let c="";return f&&(c=`'${l}' -> '${n}'
10
- `),{stdout:c,stderr:"",exitCode:0}}},w={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{v as a,w as b};
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as h,b as u}from"./chunk-GTNBSMZR.js";var k={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},g={name:"readlink",async execute(i,a){if(u(i))return h(k);let r=!1,n=0;for(;n<i.length&&i[n].startsWith("-");){let t=i[n];if(t==="-f"||t==="--canonicalize")r=!0,n++;else if(t==="--"){n++;break}else return{stdout:"",stderr:`readlink: invalid option -- '${t.slice(1)}'
3
- `,exitCode:1}}let d=i.slice(n);if(d.length===0)return{stdout:"",stderr:`readlink: missing operand
4
- `,exitCode:1};let l="",f=!1;for(let t of d){let s=a.fs.resolvePath(a.cwd,t);try{if(r){let e=s,c=new Set;for(;!c.has(e);){c.add(e);try{let o=await a.fs.readlink(e);if(o.startsWith("/"))e=o;else{let p=e.substring(0,e.lastIndexOf("/"))||"/";e=a.fs.resolvePath(p,o)}}catch{break}}l+=`${e}
5
- `}else{let e=await a.fs.readlink(s);l+=`${e}
6
- `}}catch{r?l+=`${s}
7
- `:f=!0}}return{stdout:l,stderr:"",exitCode:f?1:0}}},y={name:"readlink",flags:[{flag:"-f",type:"boolean"},{flag:"-e",type:"boolean"}],needsArgs:!0};export{g as a,y as b};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as h}from"./chunk-KGOUQS5A.js";function v(){let a=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let e=Object.getPrototypeOf(async function*(){}).constructor;e&&e!==Function&&e!==Object.getPrototypeOf(async()=>{}).constructor&&a.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return a.filter(e=>{try{return e.target[e.prop]!==void 0}catch{return!1}})}var g=typeof __BROWSER__<"u"&&__BROWSER__;function _(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var x=null;if(!g)try{let{AsyncLocalStorage:a}=h("node:async_hooks");x=a}catch{}var T=`
3
-
4
- This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,p=class extends Error{violation;constructor(e,t){super(e+T),this.violation=t,this.name="SecurityViolationError"}},u=!g&&x?new x:null,k=1e3;function D(a,e,...t){return u.run(a,()=>e(...t))}var m={enabled:!0,auditMode:!1};function O(a){return a===void 0?{...m,enabled:!1}:typeof a=="boolean"?{...m,enabled:a}:{...m,...a}}var w=class a{static instance=null;static importHooksRegistered=!1;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=O(e);if(!a.instance)a.instance=new a(t);else{let o=a.instance.config;if(t.enabled!==o.enabled||t.auditMode!==o.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${t.enabled}, auditMode: ${t.auditMode}} but singleton already has {enabled: ${o.enabled}, auditMode: ${o.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null)}static isInSandboxedContext(){return u?u?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(u)return u?.getStore()?.executionId}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let e of this.activeExecutionIds)return e}static bindCurrentContext(e){if(!u)return e;let t=u.getStore(),o=t?.sandboxActive===!0?t.executionId:a.instance?.getPreferredActiveExecutionId();if(!o)return e;let s=a.instance?.getCachedContext(o)??{sandboxActive:!0,executionId:o};return D.bind(null,s,e)}isEnabled(){return this.config.enabled===!0&&u!==null&&!g}updateConfig(e){this.config={...this.config,...e}}activate(){if(g||!this.config.enabled||!u){let o=_(),s=!1;return{run:r=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):r(),deactivate:()=>{s=!0},executionId:o}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let e=_(),t=!1;return{run:o=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),u.run({sandboxActive:!0,executionId:e},o)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!u)return e();let t=u.getStore();return t?u.run({...t,trusted:!0},e):e()}static async runTrustedAsync(e){if(!u)return e();let t=u.getStore();return t?u.run({...t,trusted:!0},e):e()}shouldBlock(){if(g||this.config.auditMode||!u)return!1;let e=u?.getStore();return!(e?.sandboxActive!==!0||e.trusted)}recordViolation(e,t,o){let s={timestamp:Date.now(),type:e,message:o,path:t,stack:new Error().stack,executionId:u?.getStore()?.executionId};if(this.violations.length<k&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(r){console.debug("[DefenseInDepthBox] onViolation callback threw:",r instanceof Error?r.message:r)}return s}createBlockingProxy(e,t,o){let s=this;return new Proxy(e,{apply(r,n,i){if(s.shouldBlock()){let c=`${t} is blocked during script execution`,l=s.recordViolation(o,t,c);throw new p(c,l)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(o,t,`${t} called (audit mode)`),Reflect.apply(r,n,i)},construct(r,n,i){if(s.shouldBlock()){let c=`${t} constructor is blocked during script execution`,l=s.recordViolation(o,t,c);throw new p(c,l)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(o,t,`${t} constructor called (audit mode)`),Reflect.construct(r,n,i)}})}createBlockingObjectProxy(e,t,o,s){let r=this;return new Proxy(e,{get(n,i,c){if(r.shouldBlock()){if(s&&typeof i=="string"&&s.has(i))return Reflect.get(n,i,c);let l=`${t}.${String(i)}`,d=`${l} is blocked during script execution`,f=r.recordViolation(o,l,d);throw new p(d,f)}if(r.config.auditMode&&u?.getStore()?.sandboxActive===!0){let l=`${t}.${String(i)}`;r.recordViolation(o,l,`${l} accessed (audit mode)`)}return Reflect.get(n,i,c)},set(n,i,c,l){if(r.shouldBlock()){let d=`${t}.${String(i)}`,f=`${d} modification is blocked during script execution`,y=r.recordViolation(o,d,f);throw new p(f,y)}return Reflect.set(n,i,c,l)},ownKeys(n){if(r.shouldBlock()){let i=`${t} enumeration is blocked during script execution`,c=r.recordViolation(o,t,i);throw new p(i,c)}return Reflect.ownKeys(n)},getOwnPropertyDescriptor(n,i){if(r.shouldBlock()){let c=`${t}.${String(i)}`,l=`${c} descriptor access is blocked during script execution`,d=r.recordViolation(o,c,l);throw new p(l,d)}return Reflect.getOwnPropertyDescriptor(n,i)},has(n,i){if(r.shouldBlock()){let c=`${t}.${String(i)}`,l=`${c} existence check is blocked during script execution`,d=r.recordViolation(o,c,l);throw new p(l,d)}return Reflect.has(n,i)}})}applyPatches(){this.patchFailures=[];let e=v(),t=new Set(["process_send","process_channel","process_stdout","process_stderr"]);for(let r of e)t.has(r.violationType)||this.applyPatch(r);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath();let o=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(r=>o.includes(r));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let o=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return o},set(s){if(e.shouldBlock()){let r="Error.prepareStackTrace modification is blocked during script execution",n=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",r);throw new p(r,n)}e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),o=s},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let r=function(...n){return u.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,n);if(this.kind==="fulfilled")return n[0];throw n[0]}return Reflect.apply(this.cb,void 0,n)})};var t=r;let o=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:o});let s=o?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(i,c){if(!u)return Reflect.apply(s,this,[i,c]);let l=u.getStore(),d=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!d)return Reflect.apply(s,this,[i,c]);let f=e.getCachedContext(d),y=(b,P)=>typeof b!="function"?b:r.bind({box:e,executionId:d,captured:f,cb:b,kind:P});return Reflect.apply(s,this,[y(i,"fulfilled"),y(c,"rejected")])},writable:!0,configurable:!0})}catch(o){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",o instanceof Error?o.message:o)}}patchPrototypeConstructor(e,t,o){let s=this;try{let r=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:r});let n=r?.value;Object.defineProperty(e,"constructor",{get(){if(s.shouldBlock()){let i=`${t} access is blocked during script execution`,c=s.recordViolation(o,t,i);throw new p(i,c)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(o,t,`${t} accessed (audit mode)`),n},set(i){if(s.shouldBlock()){let c=`${t} modification is blocked during script execution`,l=s.recordViolation(o,t,c);throw new p(c,l)}Object.defineProperty(this,"constructor",{value:i,writable:!0,configurable:!0})},configurable:!0})}catch(r){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,r instanceof Error?r.message:r)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let o=t?.value;o!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let s="process.mainModule access is blocked during script execution",r=e.recordViolation("process_main_module","process.mainModule",s);throw new p(s,r)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),o},set(s){if(e.shouldBlock()){let r="process.mainModule modification is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",r);throw new p(r,n)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let o=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let s="process.execPath access is blocked during script execution",r=e.recordViolation("process_exec_path","process.execPath",s);throw new p(s,r)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),o},set(s){if(e.shouldBlock()){let r="process.execPath modification is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",r);throw new p(r,n)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}protectDynamicImport(){if(!(g||a.importHooksRegistered))try{let e=h("node:module");if(typeof e.registerHooks=="function"){e.registerHooks({resolve(t,o,s){if(t.startsWith("data:")||t.startsWith("blob:"))throw new Error(`dynamic import of ${t.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`);return s(t,o)}}),a.importHooksRegistered=!0;return}if(typeof e.register=="function"){let t=["export async function resolve(specifier, context, nextResolve) {",' if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {',' throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");'," }"," return nextResolve(specifier, context);","}"].join(`
5
- `);e.register(`data:text/javascript,${encodeURIComponent(t)}`),a.importHooksRegistered=!0}}catch(e){console.debug("[DefenseInDepthBox] Could not register import() hooks:",e instanceof Error?e.message:e)}}protectModuleLoad(){if(!g)try{let e=null;if(typeof process<"u"){let n=process.mainModule;n&&typeof n=="object"&&(e=n.constructor)}if(!e&&typeof h<"u"&&typeof h.main<"u"&&(e=h.main.constructor),!e||typeof e._load!="function")return;let t=e._load,o=Object.getOwnPropertyDescriptor(e,"_load");this.originalDescriptors.push({target:e,prop:"_load",descriptor:o});let r=this.createBlockingProxy(t,"Module._load","module_load");Object.defineProperty(e,"_load",{value:r,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",e instanceof Error?e.message:e)}}protectModuleResolveFilename(){if(!g)try{let e=null;if(typeof process<"u"){let n=process.mainModule;n&&typeof n=="object"&&(e=n.constructor)}if(!e&&typeof h<"u"&&typeof h.main<"u"&&(e=h.main.constructor),!e||typeof e._resolveFilename!="function")return;let t=e._resolveFilename,o=Object.getOwnPropertyDescriptor(e,"_resolveFilename");this.originalDescriptors.push({target:e,prop:"_resolveFilename",descriptor:o});let r=this.createBlockingProxy(t,"Module._resolveFilename","module_resolve_filename");Object.defineProperty(e,"_resolveFilename",{value:r,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._resolveFilename"),console.debug("[DefenseInDepthBox] Could not protect Module._resolveFilename:",e instanceof Error?e.message:e)}}applyPatch(e){let{target:t,prop:o,violationType:s,strategy:r}=e;try{let n=t[o];if(n===void 0)return;let i=Object.getOwnPropertyDescriptor(t,o);if(this.originalDescriptors.push({target:t,prop:o,descriptor:i}),r==="freeze")typeof n=="object"&&n!==null&&Object.freeze(n);else{let c=this.getPathForTarget(t,o),l=typeof n=="function"?this.createBlockingProxy(n,c,s):this.createBlockingObjectProxy(n,c,s,e.allowedKeys);Object.defineProperty(t,o,{value:l,writable:!0,configurable:!0})}}catch(n){let i=this.getPathForTarget(t,o);this.patchFailures.push(i),console.debug(`[DefenseInDepthBox] Could not patch ${i}:`,n instanceof Error?n.message:n)}}restorePatches(){for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:o,descriptor:s}=this.originalDescriptors[e];try{s?Object.defineProperty(t,o,s):delete t[o]}catch(r){let n=this.getPathForTarget(t,o);console.debug(`[DefenseInDepthBox] Could not restore ${n}:`,r instanceof Error?r.message:r)}}this.originalDescriptors=[]}};export{p as a,w as b};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as n}from"./chunk-SE4C7FJY.js";var r=new Map;function h(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,o=r.get(i);return o||(o=f(e,s.ignoreCase),r.set(i,o)),o.test(l)}function f(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",n(t,c?"i":"")}export{h as a};
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as d}from"./chunk-JBABAK44.js";import{a as l}from"./chunk-4VDEBYW7.js";var g={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},k={name:"mkdir",async execute(f,o){let e=d("mkdir",f,g);if(!e.ok)return e.error;let u=e.result.flags.recursive,m=e.result.flags.verbose,i=e.result.positional;if(i.length===0)return{stdout:"",stderr:`mkdir: missing operand
3
- `,exitCode:1};let a="",t="",c=0;for(let r of i)try{let n=o.fs.resolvePath(o.cwd,r);await o.fs.mkdir(n,{recursive:u}),m&&(a+=`mkdir: created directory '${r}'
4
- `)}catch(n){let s=l(n);s.includes("ENOENT")||s.includes("no such file")?t+=`mkdir: cannot create directory '${r}': No such file or directory
5
- `:s.includes("EEXIST")||s.includes("already exists")?t+=`mkdir: cannot create directory '${r}': File exists
6
- `:t+=`mkdir: cannot create directory '${r}': ${s}
7
- `,c=1}return{stdout:a,stderr:t,exitCode:c}}},v={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{k as a,v as b};
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a,b as o}from"./chunk-WMYKQURM.js";import{a as i,b as l}from"./chunk-GTNBSMZR.js";var d={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
3
- s - seconds (default)
4
- m - minutes
5
- h - hours
6
- d - days
7
-
8
- NUMBER may be a decimal number.`,options:[" --help display this help and exit"]},u=36e5;function m(n){let s=n.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!s)return null;let e=parseFloat(s[1]);switch(s[2]||"s"){case"s":return e*1e3;case"m":return e*60*1e3;case"h":return e*60*60*1e3;case"d":return e*24*60*60*1e3;default:return null}}var c={name:"sleep",async execute(n,s){if(l(n))return i(d);if(n.length===0)return{stdout:"",stderr:`sleep: missing operand
9
- `,exitCode:1};let e=0;for(let t of n){let r=m(t);if(r===null)return{stdout:"",stderr:`sleep: invalid time interval '${t}'
10
- `,exitCode:1};e+=r}return e>u&&(e=u),s.signal?.aborted?{stdout:"",stderr:"",exitCode:0}:(s.sleep?await s.sleep(e):s.signal?await new Promise(t=>{let r=a(t,e);s.signal?.addEventListener("abort",()=>{o(r),t()},{once:!0})}):await new Promise(t=>a(t,e)),{stdout:"",stderr:"",exitCode:0})}},h={name:"sleep",flags:[],needsArgs:!0};export{c as a,h as b};