just-bash 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +326 -0
  3. package/dist/Bash.d.ts +90 -0
  4. package/dist/ai/index.d.ts +56 -0
  5. package/dist/ast/types.d.ts +518 -0
  6. package/dist/bin/chunks/alias-74DFXE2E.js +7 -0
  7. package/dist/bin/chunks/awk-S63F6IYK.js +15 -0
  8. package/dist/bin/chunks/base64-NC7HTKLZ.js +5 -0
  9. package/dist/bin/chunks/basename-Y7JDBYHN.js +6 -0
  10. package/dist/bin/chunks/bash-TQGTNXAE.js +7 -0
  11. package/dist/bin/chunks/cat-YZXBF5YF.js +6 -0
  12. package/dist/bin/chunks/chmod-3G4LK462.js +9 -0
  13. package/dist/bin/chunks/chunk-26Q3PZQ6.js +2 -0
  14. package/dist/bin/chunks/chunk-4VDEBYW7.js +2 -0
  15. package/dist/bin/chunks/chunk-5KNEBKYN.js +2 -0
  16. package/dist/bin/chunks/chunk-GTNBSMZR.js +23 -0
  17. package/dist/bin/chunks/chunk-J7BCMQDI.js +16 -0
  18. package/dist/bin/chunks/chunk-J7MJV6WO.js +3 -0
  19. package/dist/bin/chunks/chunk-LV662IGP.js +6 -0
  20. package/dist/bin/chunks/chunk-TA7RUHGQ.js +4 -0
  21. package/dist/bin/chunks/clear-GTCFHSB2.js +2 -0
  22. package/dist/bin/chunks/cp-77UY7PGN.js +8 -0
  23. package/dist/bin/chunks/curl-NE7XEWMN.js +26 -0
  24. package/dist/bin/chunks/cut-UYV3FM7R.js +6 -0
  25. package/dist/bin/chunks/date-7NBRXV2Z.js +5 -0
  26. package/dist/bin/chunks/diff-TG2NXCX2.js +19 -0
  27. package/dist/bin/chunks/dirname-VLHP44TU.js +5 -0
  28. package/dist/bin/chunks/du-4FZ7WF2P.js +8 -0
  29. package/dist/bin/chunks/echo-DEUIS5JO.js +4 -0
  30. package/dist/bin/chunks/env-FVITWNHG.js +9 -0
  31. package/dist/bin/chunks/expr-HA2ZNL6S.js +5 -0
  32. package/dist/bin/chunks/find-4B67H4RP.js +11 -0
  33. package/dist/bin/chunks/grep-OVWU4WCZ.js +15 -0
  34. package/dist/bin/chunks/head-VGXR3WWL.js +2 -0
  35. package/dist/bin/chunks/help-5V3MPCYQ.js +16 -0
  36. package/dist/bin/chunks/history-PRQ4B6N2.js +3 -0
  37. package/dist/bin/chunks/html-to-markdown-L4UWMK4S.js +84 -0
  38. package/dist/bin/chunks/jq-EYSXBSCP.js +14 -0
  39. package/dist/bin/chunks/ln-DB7J2W5X.js +10 -0
  40. package/dist/bin/chunks/ls-C4MPAF3H.js +26 -0
  41. package/dist/bin/chunks/mkdir-LWULWDHP.js +7 -0
  42. package/dist/bin/chunks/mv-TDYCNSIQ.js +7 -0
  43. package/dist/bin/chunks/paste-R36J3G4K.js +8 -0
  44. package/dist/bin/chunks/printf-BOFQVMMK.js +15 -0
  45. package/dist/bin/chunks/pwd-X4MWD4JP.js +3 -0
  46. package/dist/bin/chunks/readlink-DPNOQY67.js +7 -0
  47. package/dist/bin/chunks/rm-W6CCBEMG.js +8 -0
  48. package/dist/bin/chunks/sed-7IS44XON.js +48 -0
  49. package/dist/bin/chunks/seq-DGJILX2Q.js +7 -0
  50. package/dist/bin/chunks/sleep-E4DIYGTT.js +10 -0
  51. package/dist/bin/chunks/sort-UJP353TM.js +15 -0
  52. package/dist/bin/chunks/stat-3PHITCPO.js +9 -0
  53. package/dist/bin/chunks/tail-YSVKBQ77.js +2 -0
  54. package/dist/bin/chunks/tee-UU2VS3OM.js +3 -0
  55. package/dist/bin/chunks/timeout-OZVAGW2H.js +12 -0
  56. package/dist/bin/chunks/touch-XCIAYF5I.js +4 -0
  57. package/dist/bin/chunks/tr-2EEKHHO6.js +20 -0
  58. package/dist/bin/chunks/tree-4247W67O.js +12 -0
  59. package/dist/bin/chunks/true-JCX733LK.js +2 -0
  60. package/dist/bin/chunks/uniq-W4HF6YSB.js +5 -0
  61. package/dist/bin/chunks/wc-CNJ3QDRA.js +6 -0
  62. package/dist/bin/chunks/which-HX2NMOP3.js +3 -0
  63. package/dist/bin/chunks/xargs-YNLVLPOF.js +4 -0
  64. package/dist/bin/just-bash.js +188 -0
  65. package/dist/bin/shell/chunks/alias-74DFXE2E.js +7 -0
  66. package/dist/bin/shell/chunks/awk-S63F6IYK.js +15 -0
  67. package/dist/bin/shell/chunks/base64-NC7HTKLZ.js +5 -0
  68. package/dist/bin/shell/chunks/basename-Y7JDBYHN.js +6 -0
  69. package/dist/bin/shell/chunks/bash-TQGTNXAE.js +7 -0
  70. package/dist/bin/shell/chunks/cat-YZXBF5YF.js +6 -0
  71. package/dist/bin/shell/chunks/chmod-3G4LK462.js +9 -0
  72. package/dist/bin/shell/chunks/chunk-26Q3PZQ6.js +2 -0
  73. package/dist/bin/shell/chunks/chunk-4VDEBYW7.js +2 -0
  74. package/dist/bin/shell/chunks/chunk-5KNEBKYN.js +2 -0
  75. package/dist/bin/shell/chunks/chunk-GTNBSMZR.js +23 -0
  76. package/dist/bin/shell/chunks/chunk-J7BCMQDI.js +16 -0
  77. package/dist/bin/shell/chunks/chunk-J7MJV6WO.js +3 -0
  78. package/dist/bin/shell/chunks/chunk-LV662IGP.js +6 -0
  79. package/dist/bin/shell/chunks/chunk-TA7RUHGQ.js +4 -0
  80. package/dist/bin/shell/chunks/clear-GTCFHSB2.js +2 -0
  81. package/dist/bin/shell/chunks/cp-77UY7PGN.js +8 -0
  82. package/dist/bin/shell/chunks/curl-NE7XEWMN.js +26 -0
  83. package/dist/bin/shell/chunks/cut-UYV3FM7R.js +6 -0
  84. package/dist/bin/shell/chunks/date-7NBRXV2Z.js +5 -0
  85. package/dist/bin/shell/chunks/diff-TG2NXCX2.js +19 -0
  86. package/dist/bin/shell/chunks/dirname-VLHP44TU.js +5 -0
  87. package/dist/bin/shell/chunks/du-4FZ7WF2P.js +8 -0
  88. package/dist/bin/shell/chunks/echo-DEUIS5JO.js +4 -0
  89. package/dist/bin/shell/chunks/env-FVITWNHG.js +9 -0
  90. package/dist/bin/shell/chunks/expr-HA2ZNL6S.js +5 -0
  91. package/dist/bin/shell/chunks/find-4B67H4RP.js +11 -0
  92. package/dist/bin/shell/chunks/grep-OVWU4WCZ.js +15 -0
  93. package/dist/bin/shell/chunks/head-VGXR3WWL.js +2 -0
  94. package/dist/bin/shell/chunks/help-5V3MPCYQ.js +16 -0
  95. package/dist/bin/shell/chunks/history-PRQ4B6N2.js +3 -0
  96. package/dist/bin/shell/chunks/html-to-markdown-L4UWMK4S.js +84 -0
  97. package/dist/bin/shell/chunks/jq-EYSXBSCP.js +14 -0
  98. package/dist/bin/shell/chunks/ln-DB7J2W5X.js +10 -0
  99. package/dist/bin/shell/chunks/ls-C4MPAF3H.js +26 -0
  100. package/dist/bin/shell/chunks/mkdir-LWULWDHP.js +7 -0
  101. package/dist/bin/shell/chunks/mv-TDYCNSIQ.js +7 -0
  102. package/dist/bin/shell/chunks/paste-R36J3G4K.js +8 -0
  103. package/dist/bin/shell/chunks/printf-BOFQVMMK.js +15 -0
  104. package/dist/bin/shell/chunks/pwd-X4MWD4JP.js +3 -0
  105. package/dist/bin/shell/chunks/readlink-DPNOQY67.js +7 -0
  106. package/dist/bin/shell/chunks/rm-W6CCBEMG.js +8 -0
  107. package/dist/bin/shell/chunks/sed-7IS44XON.js +48 -0
  108. package/dist/bin/shell/chunks/seq-DGJILX2Q.js +7 -0
  109. package/dist/bin/shell/chunks/sleep-E4DIYGTT.js +10 -0
  110. package/dist/bin/shell/chunks/sort-UJP353TM.js +15 -0
  111. package/dist/bin/shell/chunks/stat-3PHITCPO.js +9 -0
  112. package/dist/bin/shell/chunks/tail-YSVKBQ77.js +2 -0
  113. package/dist/bin/shell/chunks/tee-UU2VS3OM.js +3 -0
  114. package/dist/bin/shell/chunks/timeout-OZVAGW2H.js +12 -0
  115. package/dist/bin/shell/chunks/touch-XCIAYF5I.js +4 -0
  116. package/dist/bin/shell/chunks/tr-2EEKHHO6.js +20 -0
  117. package/dist/bin/shell/chunks/tree-4247W67O.js +12 -0
  118. package/dist/bin/shell/chunks/true-JCX733LK.js +2 -0
  119. package/dist/bin/shell/chunks/uniq-W4HF6YSB.js +5 -0
  120. package/dist/bin/shell/chunks/wc-CNJ3QDRA.js +6 -0
  121. package/dist/bin/shell/chunks/which-HX2NMOP3.js +3 -0
  122. package/dist/bin/shell/chunks/xargs-YNLVLPOF.js +4 -0
  123. package/dist/bin/shell/shell.js +172 -0
  124. package/dist/bundle/ai/index.js +541 -0
  125. package/dist/bundle/chunks/alias-7ZSTROM7.js +6 -0
  126. package/dist/bundle/chunks/awk-V4C3GTJI.js +14 -0
  127. package/dist/bundle/chunks/base64-WATI5PWI.js +4 -0
  128. package/dist/bundle/chunks/basename-SB5JXIY3.js +5 -0
  129. package/dist/bundle/chunks/bash-T4PXVRYX.js +6 -0
  130. package/dist/bundle/chunks/cat-5KESXK2M.js +5 -0
  131. package/dist/bundle/chunks/chmod-VLKWIL3N.js +8 -0
  132. package/dist/bundle/chunks/chunk-3YNHMZ5M.js +2 -0
  133. package/dist/bundle/chunks/chunk-44UOCSGV.js +1 -0
  134. package/dist/bundle/chunks/chunk-74CEPOFO.js +22 -0
  135. package/dist/bundle/chunks/chunk-JYYFSUWP.js +5 -0
  136. package/dist/bundle/chunks/chunk-UJMN5NLH.js +1 -0
  137. package/dist/bundle/chunks/chunk-W2EKKAIL.js +15 -0
  138. package/dist/bundle/chunks/chunk-ZVV5VXYZ.js +3 -0
  139. package/dist/bundle/chunks/clear-ZBD2DMXN.js +1 -0
  140. package/dist/bundle/chunks/cp-BLHAPLQZ.js +7 -0
  141. package/dist/bundle/chunks/curl-PA2MWGKN.js +25 -0
  142. package/dist/bundle/chunks/cut-7RHEYJ7Y.js +5 -0
  143. package/dist/bundle/chunks/date-YOOSNZVA.js +4 -0
  144. package/dist/bundle/chunks/diff-IVJFQANX.js +6 -0
  145. package/dist/bundle/chunks/dirname-Q5HDZLH2.js +4 -0
  146. package/dist/bundle/chunks/du-I5HYAKTQ.js +7 -0
  147. package/dist/bundle/chunks/echo-W2TA2N7Y.js +3 -0
  148. package/dist/bundle/chunks/env-OORA5GFS.js +8 -0
  149. package/dist/bundle/chunks/expr-A4LJAGVP.js +4 -0
  150. package/dist/bundle/chunks/find-K3NO35MZ.js +10 -0
  151. package/dist/bundle/chunks/grep-3D2INI4S.js +14 -0
  152. package/dist/bundle/chunks/head-7H5R4WKO.js +1 -0
  153. package/dist/bundle/chunks/help-SDCRRU2F.js +15 -0
  154. package/dist/bundle/chunks/history-7Z2STZ6Y.js +2 -0
  155. package/dist/bundle/chunks/html-to-markdown-XMBYO6FD.js +4 -0
  156. package/dist/bundle/chunks/jq-7R2XGLLH.js +13 -0
  157. package/dist/bundle/chunks/ln-UTUVIAFP.js +9 -0
  158. package/dist/bundle/chunks/ls-B7C35UDO.js +23 -0
  159. package/dist/bundle/chunks/mkdir-WYI2LJ6H.js +6 -0
  160. package/dist/bundle/chunks/mv-GN23UIZU.js +6 -0
  161. package/dist/bundle/chunks/paste-L4TYPVSP.js +7 -0
  162. package/dist/bundle/chunks/printf-3ZT5XOIZ.js +14 -0
  163. package/dist/bundle/chunks/pwd-ZVX5RTL4.js +2 -0
  164. package/dist/bundle/chunks/readlink-HHC33N5C.js +6 -0
  165. package/dist/bundle/chunks/rm-5X2XSQQ6.js +7 -0
  166. package/dist/bundle/chunks/sed-UZJSXYQZ.js +47 -0
  167. package/dist/bundle/chunks/seq-TFPZQZPJ.js +6 -0
  168. package/dist/bundle/chunks/sleep-QJBQD6VS.js +9 -0
  169. package/dist/bundle/chunks/sort-LHMQWYH2.js +14 -0
  170. package/dist/bundle/chunks/stat-TM5F5YO4.js +8 -0
  171. package/dist/bundle/chunks/tail-BLGGG2VX.js +1 -0
  172. package/dist/bundle/chunks/tee-VCNOG5VI.js +2 -0
  173. package/dist/bundle/chunks/timeout-THAT7IOO.js +11 -0
  174. package/dist/bundle/chunks/touch-Z5XRYFYY.js +3 -0
  175. package/dist/bundle/chunks/tr-UV4V27RJ.js +19 -0
  176. package/dist/bundle/chunks/tree-75UXQ4XJ.js +11 -0
  177. package/dist/bundle/chunks/true-OD7ZXH3O.js +1 -0
  178. package/dist/bundle/chunks/uniq-IIOQKNTS.js +4 -0
  179. package/dist/bundle/chunks/wc-OXLYBRUE.js +5 -0
  180. package/dist/bundle/chunks/which-ONWH3TNF.js +2 -0
  181. package/dist/bundle/chunks/xargs-E5JPQL24.js +3 -0
  182. package/dist/bundle/index.js +141 -0
  183. package/dist/commands/alias/alias.d.ts +3 -0
  184. package/dist/commands/awk/awk.d.ts +2 -0
  185. package/dist/commands/awk/executor.d.ts +3 -0
  186. package/dist/commands/awk/expressions.d.ts +3 -0
  187. package/dist/commands/awk/functions.d.ts +12 -0
  188. package/dist/commands/awk/parser.d.ts +3 -0
  189. package/dist/commands/awk/types.d.ts +44 -0
  190. package/dist/commands/base64/base64.d.ts +5 -0
  191. package/dist/commands/basename/basename.d.ts +2 -0
  192. package/dist/commands/bash/bash.d.ts +3 -0
  193. package/dist/commands/cat/cat.d.ts +2 -0
  194. package/dist/commands/chmod/chmod.d.ts +2 -0
  195. package/dist/commands/clear/clear.d.ts +2 -0
  196. package/dist/commands/cp/cp.d.ts +2 -0
  197. package/dist/commands/curl/curl.d.ts +8 -0
  198. package/dist/commands/curl/form.d.ts +21 -0
  199. package/dist/commands/curl/help.d.ts +9 -0
  200. package/dist/commands/curl/parse.d.ts +9 -0
  201. package/dist/commands/curl/types.d.ts +31 -0
  202. package/dist/commands/curl/utils.d.ts +20 -0
  203. package/dist/commands/cut/cut.d.ts +2 -0
  204. package/dist/commands/date/date.d.ts +5 -0
  205. package/dist/commands/diff/diff.d.ts +5 -0
  206. package/dist/commands/dirname/dirname.d.ts +2 -0
  207. package/dist/commands/du/du.d.ts +2 -0
  208. package/dist/commands/echo/echo.d.ts +2 -0
  209. package/dist/commands/env/env.d.ts +3 -0
  210. package/dist/commands/expr/expr.d.ts +7 -0
  211. package/dist/commands/find/find.d.ts +2 -0
  212. package/dist/commands/find/matcher.d.ts +3 -0
  213. package/dist/commands/find/parser.d.ts +2 -0
  214. package/dist/commands/find/types.d.ts +70 -0
  215. package/dist/commands/grep/grep.d.ts +4 -0
  216. package/dist/commands/head/head-tail-shared.d.ts +38 -0
  217. package/dist/commands/head/head.d.ts +2 -0
  218. package/dist/commands/help/help.d.ts +2 -0
  219. package/dist/commands/help.d.ts +16 -0
  220. package/dist/commands/history/history.d.ts +2 -0
  221. package/dist/commands/html-to-markdown/html-to-markdown.d.ts +7 -0
  222. package/dist/commands/jq/jq.d.ts +14 -0
  223. package/dist/commands/ln/ln.d.ts +2 -0
  224. package/dist/commands/ls/ls.d.ts +2 -0
  225. package/dist/commands/mkdir/mkdir.d.ts +2 -0
  226. package/dist/commands/mv/mv.d.ts +2 -0
  227. package/dist/commands/paste/paste.d.ts +2 -0
  228. package/dist/commands/printf/printf.d.ts +2 -0
  229. package/dist/commands/pwd/pwd.d.ts +2 -0
  230. package/dist/commands/readlink/readlink.d.ts +2 -0
  231. package/dist/commands/registry.d.ts +33 -0
  232. package/dist/commands/rm/rm.d.ts +2 -0
  233. package/dist/commands/sed/executor.d.ts +7 -0
  234. package/dist/commands/sed/parser.d.ts +5 -0
  235. package/dist/commands/sed/sed.d.ts +2 -0
  236. package/dist/commands/sed/types.d.ts +141 -0
  237. package/dist/commands/seq/seq.d.ts +14 -0
  238. package/dist/commands/sleep/sleep.d.ts +2 -0
  239. package/dist/commands/sort/comparator.d.ts +9 -0
  240. package/dist/commands/sort/parser.d.ts +11 -0
  241. package/dist/commands/sort/sort.d.ts +2 -0
  242. package/dist/commands/sort/types.d.ts +18 -0
  243. package/dist/commands/stat/stat.d.ts +2 -0
  244. package/dist/commands/tail/tail.d.ts +2 -0
  245. package/dist/commands/tee/tee.d.ts +2 -0
  246. package/dist/commands/timeout/timeout.d.ts +2 -0
  247. package/dist/commands/touch/touch.d.ts +2 -0
  248. package/dist/commands/tr/tr.d.ts +2 -0
  249. package/dist/commands/tree/tree.d.ts +2 -0
  250. package/dist/commands/true/true.d.ts +3 -0
  251. package/dist/commands/uniq/uniq.d.ts +2 -0
  252. package/dist/commands/wc/wc.d.ts +2 -0
  253. package/dist/commands/which/which.d.ts +2 -0
  254. package/dist/commands/xargs/xargs.d.ts +2 -0
  255. package/dist/fs-interface.d.ts +186 -0
  256. package/dist/fs.d.ts +39 -0
  257. package/dist/index.d.ts +12 -0
  258. package/dist/interpreter/arithmetic.d.ts +29 -0
  259. package/dist/interpreter/builtins/break.d.ts +6 -0
  260. package/dist/interpreter/builtins/cd.d.ts +6 -0
  261. package/dist/interpreter/builtins/continue.d.ts +6 -0
  262. package/dist/interpreter/builtins/declare.d.ts +29 -0
  263. package/dist/interpreter/builtins/eval.d.ts +9 -0
  264. package/dist/interpreter/builtins/exit.d.ts +5 -0
  265. package/dist/interpreter/builtins/export.d.ts +13 -0
  266. package/dist/interpreter/builtins/index.d.ts +36 -0
  267. package/dist/interpreter/builtins/let.d.ts +18 -0
  268. package/dist/interpreter/builtins/local.d.ts +6 -0
  269. package/dist/interpreter/builtins/read.d.ts +6 -0
  270. package/dist/interpreter/builtins/return.d.ts +6 -0
  271. package/dist/interpreter/builtins/set.d.ts +6 -0
  272. package/dist/interpreter/builtins/shift.d.ts +12 -0
  273. package/dist/interpreter/builtins/source.d.ts +6 -0
  274. package/dist/interpreter/builtins/unset.d.ts +12 -0
  275. package/dist/interpreter/builtins/variable-helpers.d.ts +30 -0
  276. package/dist/interpreter/conditionals.d.ts +17 -0
  277. package/dist/interpreter/control-flow.d.ts +21 -0
  278. package/dist/interpreter/errors.d.ts +107 -0
  279. package/dist/interpreter/expansion/analysis.d.ts +39 -0
  280. package/dist/interpreter/expansion/brace-range.d.ts +20 -0
  281. package/dist/interpreter/expansion/pattern.d.ts +22 -0
  282. package/dist/interpreter/expansion/variable.d.ts +27 -0
  283. package/dist/interpreter/expansion/word-split.d.ts +24 -0
  284. package/dist/interpreter/expansion.d.ts +27 -0
  285. package/dist/interpreter/functions.d.ts +12 -0
  286. package/dist/interpreter/helpers/array.d.ts +23 -0
  287. package/dist/interpreter/helpers/condition.d.ts +22 -0
  288. package/dist/interpreter/helpers/errors.d.ts +8 -0
  289. package/dist/interpreter/helpers/file-tests.d.ts +33 -0
  290. package/dist/interpreter/helpers/ifs.d.ts +43 -0
  291. package/dist/interpreter/helpers/loop.d.ts +24 -0
  292. package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
  293. package/dist/interpreter/helpers/readonly.d.ts +21 -0
  294. package/dist/interpreter/helpers/regex.d.ts +8 -0
  295. package/dist/interpreter/helpers/result.d.ts +54 -0
  296. package/dist/interpreter/helpers/statements.d.ts +20 -0
  297. package/dist/interpreter/helpers/string-compare.d.ts +22 -0
  298. package/dist/interpreter/helpers/string-tests.d.ts +13 -0
  299. package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
  300. package/dist/interpreter/helpers/word-parts.d.ts +22 -0
  301. package/dist/interpreter/index.d.ts +3 -0
  302. package/dist/interpreter/interpreter.d.ts +61 -0
  303. package/dist/interpreter/redirections.d.ts +14 -0
  304. package/dist/interpreter/types.d.ts +68 -0
  305. package/dist/limits.d.ts +26 -0
  306. package/dist/network/allow-list/shared.d.ts +45 -0
  307. package/dist/network/allow-list.d.ts +51 -0
  308. package/dist/network/fetch.d.ts +25 -0
  309. package/dist/network/index.d.ts +7 -0
  310. package/dist/network/types.d.ts +85 -0
  311. package/dist/overlay-fs/OverlayFs.d.ts +87 -0
  312. package/dist/overlay-fs/index.d.ts +1 -0
  313. package/dist/parser/arithmetic-parser.d.ts +25 -0
  314. package/dist/parser/command-parser.d.ts +10 -0
  315. package/dist/parser/compound-parser.d.ts +14 -0
  316. package/dist/parser/conditional-parser.d.ts +8 -0
  317. package/dist/parser/expansion-parser.d.ts +10 -0
  318. package/dist/parser/lexer.d.ts +135 -0
  319. package/dist/parser/parser.d.ts +92 -0
  320. package/dist/parser/types.d.ts +23 -0
  321. package/dist/parser/word-parser.d.ts +33 -0
  322. package/dist/sandbox/Command.d.ts +28 -0
  323. package/dist/sandbox/Sandbox.d.ts +60 -0
  324. package/dist/sandbox/index.d.ts +2 -0
  325. package/dist/types.d.ts +80 -0
  326. package/dist/utils/args.d.ts +55 -0
  327. package/dist/utils/file-reader.d.ts +64 -0
  328. package/dist/utils/glob.d.ts +25 -0
  329. package/package.json +103 -0
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ function n(e){return e instanceof Error?e.message:String(e)}export{n as a};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ function s(t){let e=`${t.name} - ${t.summary}
3
+
4
+ `;if(e+=`Usage: ${t.usage}
5
+ `,t.description){if(e+=`
6
+ Description:
7
+ `,typeof t.description=="string")for(let n of t.description.split(`
8
+ `))e+=n?` ${n}
9
+ `:`
10
+ `;else if(t.description.length>0)for(let n of t.description)e+=n?` ${n}
11
+ `:`
12
+ `}if(t.options&&t.options.length>0){e+=`
13
+ Options:
14
+ `;for(let n of t.options)e+=` ${n}
15
+ `}if(t.examples&&t.examples.length>0){e+=`
16
+ Examples:
17
+ `;for(let n of t.examples)e+=` ${n}
18
+ `}if(t.notes&&t.notes.length>0){e+=`
19
+ Notes:
20
+ `;for(let n of t.notes)e+=` ${n}
21
+ `}return{stdout:e,stderr:"",exitCode:0}}function o(t){return t.includes("--help")}function r(t,e){return{stdout:"",stderr:e.startsWith("--")?`${t}: unrecognized option '${e}'
22
+ `:`${t}: invalid option -- '${e.replace(/^-/,"")}'
23
+ `,exitCode:1}}export{s as a,o as b,r as c};
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import{c as d}from"./chunk-GTNBSMZR.js";function w(t,r){let i=10,s=null,o=!1,l=!1,n=!1,u=[];for(let f=0;f<t.length;f++){let e=t[f];if(e==="-n"&&f+1<t.length){let a=t[++f];r==="tail"&&a.startsWith("+")?(n=!0,i=parseInt(a.slice(1),10)):i=parseInt(a,10)}else if(r==="tail"&&e.startsWith("-n+"))n=!0,i=parseInt(e.slice(3),10);else if(e.startsWith("-n"))i=parseInt(e.slice(2),10);else if(e==="-c"&&f+1<t.length)s=parseInt(t[++f],10);else if(e.startsWith("-c"))s=parseInt(e.slice(2),10);else if(e.startsWith("--bytes="))s=parseInt(e.slice(8),10);else if(e.startsWith("--lines="))i=parseInt(e.slice(8),10);else if(e==="-q"||e==="--quiet"||e==="--silent")o=!0;else if(e==="-v"||e==="--verbose")l=!0;else if(e.match(/^-\d+$/))i=parseInt(e.slice(1),10);else{if(e.startsWith("--"))return{ok:!1,error:d(r,e)};if(e.startsWith("-")&&e!=="-")return{ok:!1,error:d(r,e)};u.push(e)}}return s!==null&&(Number.isNaN(s)||s<0)?{ok:!1,error:{stdout:"",stderr:`${r}: invalid number of bytes
3
+ `,exitCode:1}}:Number.isNaN(i)||i<0?{ok:!1,error:{stdout:"",stderr:`${r}: invalid number of lines
4
+ `,exitCode:1}}:{ok:!0,options:{lines:i,bytes:s,quiet:o,verbose:l,files:u,fromLine:n}}}async function I(t,r,i,s){let{quiet:o,verbose:l,files:n}=r;if(n.length===0)return{stdout:s(t.stdin),stderr:"",exitCode:0};let u="",f="",e=0,a=l||!o&&n.length>1;for(let h=0;h<n.length;h++){let p=n[h];a&&(h>0&&(u+=`
5
+ `),u+=`==> ${p} <==
6
+ `);try{let c=t.fs.resolvePath(t.cwd,p),b=await t.fs.readFile(c);u+=s(b)}catch{f+=`${i}: ${p}: No such file or directory
7
+ `,e=1}}return{stdout:u,stderr:f,exitCode:e}}function W(t,r,i){if(i!==null)return t.slice(0,i);if(r===0)return"";let s=0,o=0,l=t.length;for(;s<l&&o<r;){let n=t.indexOf(`
8
+ `,s);if(n===-1)return`${t}
9
+ `;o++,s=n+1}return s>0?t.slice(0,s):""}function $(t,r,i,s){if(i!==null)return t.slice(-i);let o=t.length;if(o===0)return"";if(s){let f=0,e=1;for(;f<o&&e<r;){let h=t.indexOf(`
10
+ `,f);if(h===-1)break;e++,f=h+1}let a=t.slice(f);return a.endsWith(`
11
+ `)?a:`${a}
12
+ `}if(r===0)return"";let l=o-1;t[l]===`
13
+ `&&l--;let n=0;for(;l>=0&&n<r;){if(t[l]===`
14
+ `&&(n++,n===r)){l++;break}l--}l<0&&(l=0);let u=t.slice(l);return t[o-1]===`
15
+ `?u:`${u}
16
+ `}export{w as a,I as b,W as c,$ as d};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ async function u(e,n,s){let{cmdName:t,allowStdinMarker:f=!0,stopOnError:i=!1}=s;if(n.length===0)return{files:[{filename:"",content:e.stdin}],stderr:"",exitCode:0};let r=[],a="",c=0;for(let o of n){if(f&&o==="-"){r.push({filename:"-",content:e.stdin});continue}try{let l=e.fs.resolvePath(e.cwd,o),d=await e.fs.readFile(l);r.push({filename:o,content:d})}catch{if(a+=`${t}: ${o}: No such file or directory
3
+ `,c=1,i)return{files:r,stderr:a,exitCode:c}}}return{files:r,stderr:a,exitCode:c}}async function h(e,n,s){let t=await u(e,n,{...s,stopOnError:!0});return t.exitCode!==0?{ok:!1,error:{stdout:"",stderr:t.stderr,exitCode:t.exitCode}}:{ok:!0,content:t.files.map(i=>i.content).join("")}}export{u as a,h as b};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ var n=class extends Error{stdout;stderr;constructor(t,s="",e=""){super(t),this.stdout=s,this.stderr=e}prependOutput(t,s){this.stdout=t+this.stdout,this.stderr=s+this.stderr}},o=class extends n{levels;name="BreakError";constructor(t=1,s="",e=""){super("break",s,e),this.levels=t}},i=class extends n{levels;name="ContinueError";constructor(t=1,s="",e=""){super("continue",s,e),this.levels=t}},c=class extends n{exitCode;name="ReturnError";constructor(t=0,s="",e=""){super("return",s,e),this.exitCode=t}},a=class extends n{exitCode;name="ErrexitError";constructor(t,s="",e=""){super(`errexit: command exited with status ${t}`,s,e),this.exitCode=t}},d=class extends n{varName;name="NounsetError";constructor(t,s=""){super(`${t}: unbound variable`,s,`bash: ${t}: unbound variable
3
+ `),this.varName=t}},x=class extends n{exitCode;name="ExitError";constructor(t,s="",e=""){super("exit",s,e),this.exitCode=t}},p=class extends n{name="ArithmeticError";constructor(t,s="",e=""){super(t,s,e),this.stderr=e||`bash: ${t}
4
+ `}},h=class extends n{name="BadSubstitutionError";constructor(t,s="",e=""){super(t,s,e),this.stderr=e||`bash: ${t}: bad substitution
5
+ `}},l=class extends n{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(t,s,e="",u=""){super(t,e,u),this.limitType=s,this.stderr=u||`bash: ${t}
6
+ `}};function b(r){return r instanceof o||r instanceof i||r instanceof c}export{o as a,i as b,c,a as d,d as e,x as f,p as g,h,l as i,b as j};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{c as p}from"./chunk-GTNBSMZR.js";function x(a,i,d){let g=new Map,h=new Map;for(let[t,e]of Object.entries(d)){let n={name:t,type:e.type};e.short&&g.set(e.short,n),e.long&&h.set(e.long,n)}let s={};for(let[t,e]of Object.entries(d))e.default!==void 0?s[t]=e.default:e.type==="boolean"&&(s[t]=!1);let b=[],k=!1;for(let t=0;t<i.length;t++){let e=i[t];if(k||!e.startsWith("-")||e==="-"){b.push(e);continue}if(e==="--"){k=!0;continue}if(e.startsWith("--")){let n=e.indexOf("="),o,r;n!==-1?(o=e.slice(2,n),r=e.slice(n+1)):o=e.slice(2);let f=h.get(o);if(!f)return{ok:!1,error:p(a,e)};let{name:l,type:u}=f;if(u==="boolean")s[l]=!0;else{if(r===void 0){if(t+1>=i.length)return{ok:!1,error:{stdout:"",stderr:`${a}: option '--${o}' requires an argument
3
+ `,exitCode:1}};r=i[++t]}s[l]=u==="number"?parseInt(r,10):r}}else{let n=e.slice(1);for(let o=0;o<n.length;o++){let r=n[o],f=g.get(r);if(!f)return{ok:!1,error:p(a,`-${r}`)};let{name:l,type:u}=f;if(u==="boolean")s[l]=!0;else{let c;if(o+1<n.length)c=n.slice(o+1);else if(t+1<i.length)c=i[++t];else return{ok:!1,error:{stdout:"",stderr:`${a}: option requires an argument -- '${r}'
4
+ `,exitCode:1}};s[l]=u==="number"?parseInt(c,10):c;break}}}}return{ok:!0,result:{flags:s,positional:b}}}export{x as a};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a as e,b as r}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var t={name:"clear",summary:"clear the terminal screen",usage:"clear [OPTIONS]",options:[" --help display this help and exit"]},s={name:"clear",async execute(a,c){return r(a)?e(t):{stdout:"\x1B[2J\x1B[H",stderr:"",exitCode:0}}};export{s as clearCommand};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import{a as m}from"./chunk-TA7RUHGQ.js";import{a as $}from"./chunk-4VDEBYW7.js";import{a as g,b as y}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var D={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},E={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},R={name:"cp",async execute(f,e){if(y(f))return g(D);let t=m("cp",f,E);if(!t.ok)return t.error;let u=t.result.flags.recursive||t.result.flags.recursiveUpper,w=t.result.flags.noClobber,C=t.result.flags.preserve,P=t.result.flags.verbose,a=t.result.positional;if(a.length<2)return{stdout:"",stderr:`cp: missing destination file operand
3
+ `,exitCode:1};let d=a.pop()??"",h=a,o=e.fs.resolvePath(e.cwd,d),v="",n="",l=0,p=!1;try{p=(await e.fs.stat(o)).isDirectory}catch{}if(h.length>1&&!p)return{stdout:"",stderr:`cp: target '${d}' is not a directory
4
+ `,exitCode:1};for(let r of h)try{let i=e.fs.resolvePath(e.cwd,r),s=await e.fs.stat(i),c=o;if(p){let b=r.split("/").pop()||r;c=o==="/"?`/${b}`:`${o}/${b}`}if(s.isDirectory&&!u){n+=`cp: -r not specified; omitting directory '${r}'
5
+ `,l=1;continue}if(w)try{await e.fs.stat(c);continue}catch{}await e.fs.cp(i,c,{recursive:u}),P&&(v+=`'${r}' -> '${c}'
6
+ `)}catch(i){let s=$(i);s.includes("ENOENT")||s.includes("no such file")?n+=`cp: cannot stat '${r}': No such file or directory
7
+ `:n+=`cp: cannot copy '${r}': ${s}
8
+ `,l=1}return{stdout:v,stderr:n,exitCode:l}}};export{R as cpCommand};
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import{a as b}from"./chunk-4VDEBYW7.js";import{a as T,b as y,c as f}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";function u(s){let t=s.indexOf("=");if(t>=0){let r=s.slice(0,t),e=s.slice(t+1);return r?`${encodeURIComponent(r)}=${encodeURIComponent(e)}`:encodeURIComponent(e)}return encodeURIComponent(s)}function c(s){let t=s.indexOf("=");if(t<0)return null;let r=s.slice(0,t),e=s.slice(t+1),i,a,o=e.match(/;type=([^;]+)$/);o&&(a=o[1],e=e.slice(0,-o[0].length));let n=e.match(/;filename=([^;]+)/);return n&&(i=n[1],e=e.replace(n[0],"")),(e.startsWith("@")||e.startsWith("<"))&&(i=i??e.slice(1).split("/").pop()),{name:r,value:e,filename:i,contentType:a}}function w(s,t){let r=`----CurlFormBoundary${Date.now().toString(36)}`,e=[];for(let i of s){let a=i.value;if(a.startsWith("@")||a.startsWith("<")){let n=a.slice(1);a=t.get(n)??""}let o=`--${r}\r
3
+ `;i.filename?(o+=`Content-Disposition: form-data; name="${i.name}"; filename="${i.filename}"\r
4
+ `,i.contentType&&(o+=`Content-Type: ${i.contentType}\r
5
+ `)):o+=`Content-Disposition: form-data; name="${i.name}"\r
6
+ `,o+=`\r
7
+ ${a}\r
8
+ `,e.push(o)}return e.push(`--${r}--\r
9
+ `),{body:e.join(""),boundary:r}}var O={name:"curl",summary:"transfer a URL",usage:"curl [OPTIONS] URL",options:["-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)","-H, --header HEADER Add header (can be used multiple times)","-d, --data DATA HTTP POST data"," --data-raw DATA HTTP POST data (no @ interpretation)"," --data-binary DATA HTTP POST binary data"," --data-urlencode DATA URL-encode and POST data","-F, --form NAME=VALUE Multipart form data","-u, --user USER:PASS HTTP authentication","-A, --user-agent STR Set User-Agent header","-e, --referer URL Set Referer header","-b, --cookie DATA Send cookies (name=value or @file)","-c, --cookie-jar FILE Save cookies to file","-T, --upload-file FILE Upload file (PUT)","-o, --output FILE Write output to file","-O, --remote-name Write to file named from URL","-I, --head Show headers only (HEAD request)","-i, --include Include response headers in output","-s, --silent Silent mode (no progress)","-S, --show-error Show errors even when silent","-f, --fail Fail silently on HTTP errors (no output)","-L, --location Follow redirects (default)"," --max-redirs NUM Maximum redirects (default: 20)","-m, --max-time SECS Maximum time for request"," --connect-timeout SECS Connection timeout","-w, --write-out FMT Output format after completion","-v, --verbose Verbose output"," --help Display this help and exit","","Note: Network access must be configured via BashEnv network option."," curl is not available by default for security reasons."]};function S(s){let t={method:"GET",headers:{},dataBinary:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1};for(let r=0;r<s.length;r++){let e=s[r];if(e==="-X"||e==="--request")t.method=s[++r]??"GET";else if(e.startsWith("-X"))t.method=e.slice(2);else if(e.startsWith("--request="))t.method=e.slice(10);else if(e==="-H"||e==="--header"){let i=s[++r];if(i){let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),n=i.slice(a+1).trim();t.headers[o]=n}}}else if(e.startsWith("--header=")){let i=e.slice(9),a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),n=i.slice(a+1).trim();t.headers[o]=n}}else if(e==="-d"||e==="--data"||e==="--data-raw")t.data=s[++r]??"",t.method==="GET"&&(t.method="POST");else if(e.startsWith("-d"))t.data=e.slice(2),t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data="))t.data=e.slice(7),t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data-raw="))t.data=e.slice(11),t.method==="GET"&&(t.method="POST");else if(e==="--data-binary")t.data=s[++r]??"",t.dataBinary=!0,t.method==="GET"&&(t.method="POST");else if(e.startsWith("--data-binary="))t.data=e.slice(14),t.dataBinary=!0,t.method==="GET"&&(t.method="POST");else if(e==="--data-urlencode"){let i=s[++r]??"";t.data=(t.data?`${t.data}&`:"")+u(i),t.method==="GET"&&(t.method="POST")}else if(e.startsWith("--data-urlencode=")){let i=e.slice(17);t.data=(t.data?`${t.data}&`:"")+u(i),t.method==="GET"&&(t.method="POST")}else if(e==="-F"||e==="--form"){let i=s[++r]??"",a=c(i);a&&t.formFields.push(a),t.method==="GET"&&(t.method="POST")}else if(e.startsWith("--form=")){let i=e.slice(7),a=c(i);a&&t.formFields.push(a),t.method==="GET"&&(t.method="POST")}else if(e==="-u"||e==="--user")t.user=s[++r];else if(e.startsWith("-u"))t.user=e.slice(2);else if(e.startsWith("--user="))t.user=e.slice(7);else if(e==="-A"||e==="--user-agent")t.headers["User-Agent"]=s[++r]??"";else if(e.startsWith("-A"))t.headers["User-Agent"]=e.slice(2);else if(e.startsWith("--user-agent="))t.headers["User-Agent"]=e.slice(13);else if(e==="-e"||e==="--referer")t.headers.Referer=s[++r]??"";else if(e.startsWith("-e"))t.headers.Referer=e.slice(2);else if(e.startsWith("--referer="))t.headers.Referer=e.slice(10);else if(e==="-b"||e==="--cookie")t.headers.Cookie=s[++r]??"";else if(e.startsWith("-b"))t.headers.Cookie=e.slice(2);else if(e.startsWith("--cookie="))t.headers.Cookie=e.slice(9);else if(e==="-c"||e==="--cookie-jar")t.cookieJar=s[++r];else if(e.startsWith("--cookie-jar="))t.cookieJar=e.slice(13);else if(e==="-T"||e==="--upload-file")t.uploadFile=s[++r],t.method==="GET"&&(t.method="PUT");else if(e.startsWith("--upload-file="))t.uploadFile=e.slice(14),t.method==="GET"&&(t.method="PUT");else if(e==="-m"||e==="--max-time"){let i=parseFloat(s[++r]??"0");!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(e.startsWith("--max-time=")){let i=parseFloat(e.slice(11));!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(e==="--connect-timeout"){let i=parseFloat(s[++r]??"0");!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(e.startsWith("--connect-timeout=")){let i=parseFloat(e.slice(18));!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(e==="-o"||e==="--output")t.outputFile=s[++r];else if(e.startsWith("--output="))t.outputFile=e.slice(9);else if(e==="-O"||e==="--remote-name")t.useRemoteName=!0;else if(e==="-I"||e==="--head")t.headOnly=!0,t.method="HEAD";else if(e==="-i"||e==="--include")t.includeHeaders=!0;else if(e==="-s"||e==="--silent")t.silent=!0;else if(e==="-S"||e==="--show-error")t.showError=!0;else if(e==="-f"||e==="--fail")t.failSilently=!0;else if(e==="-L"||e==="--location")t.followRedirects=!0;else if(e==="--max-redirs")r++;else if(!e.startsWith("--max-redirs="))if(e==="-w"||e==="--write-out")t.writeOut=s[++r];else if(e.startsWith("--write-out="))t.writeOut=e.slice(12);else if(e==="-v"||e==="--verbose")t.verbose=!0;else{if(e.startsWith("--")&&e!=="--")return f("curl",e);if(e.startsWith("-")&&e!=="-")for(let i of e.slice(1))switch(i){case"s":t.silent=!0;break;case"S":t.showError=!0;break;case"f":t.failSilently=!0;break;case"L":t.followRedirects=!0;break;case"I":t.headOnly=!0,t.method="HEAD";break;case"i":t.includeHeaders=!0;break;case"O":t.useRemoteName=!0;break;case"v":t.verbose=!0;break;default:return f("curl",`-${i}`)}else e.startsWith("-")||(t.url=e)}}return t}function h(s){return Object.entries(s).map(([t,r])=>`${t}: ${r}`).join(`\r
10
+ `)}function E(s){try{return new URL(s).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function m(s,t){let r=s;return r=r.replace(/%\{http_code\}/g,String(t.status)),r=r.replace(/%\{content_type\}/g,t.headers["content-type"]||""),r=r.replace(/%\{url_effective\}/g,t.url),r=r.replace(/%\{size_download\}/g,String(t.bodyLength)),r=r.replace(/\\n/g,`
11
+ `),r}async function F(s,t){if(s.uploadFile){let r=t.fs.resolvePath(t.cwd,s.uploadFile);return{body:await t.fs.readFile(r)}}if(s.formFields.length>0){let r=new Map;for(let a of s.formFields)if(a.value.startsWith("@")||a.value.startsWith("<")){let o=t.fs.resolvePath(t.cwd,a.value.slice(1));try{let n=await t.fs.readFile(o);r.set(a.value.slice(1),n)}catch{r.set(a.value.slice(1),"")}}let{body:e,boundary:i}=w(s.formFields,r);return{body:e,contentType:`multipart/form-data; boundary=${i}`}}return s.data!==void 0?{body:s.data}:{}}function P(s,t){let r={...s.headers};if(s.user){let e=Buffer.from(s.user).toString("base64");r.Authorization=`Basic ${e}`}return t&&!r["Content-Type"]&&(r["Content-Type"]=t),r}async function W(s,t,r){if(!s.cookieJar)return;let e=t["set-cookie"];if(!e)return;let i=r.fs.resolvePath(r.cwd,s.cookieJar);await r.fs.writeFile(i,e)}function $(s,t,r){let e="";if(s.verbose){e+=`> ${s.method} ${r}
12
+ `;for(let[i,a]of Object.entries(s.headers))e+=`> ${i}: ${a}
13
+ `;e+=`>
14
+ `,e+=`< HTTP/1.1 ${t.status} ${t.statusText}
15
+ `;for(let[i,a]of Object.entries(t.headers))e+=`< ${i}: ${a}
16
+ `;e+=`<
17
+ `}return s.includeHeaders&&!s.verbose&&(e+=`HTTP/1.1 ${t.status} ${t.statusText}\r
18
+ `,e+=h(t.headers),e+=`\r
19
+ \r
20
+ `),s.headOnly?s.includeHeaders||s.verbose||(e+=`HTTP/1.1 ${t.status} ${t.statusText}\r
21
+ `,e+=h(t.headers),e+=`\r
22
+ `):e+=t.body,s.writeOut&&(e+=m(s.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.length})),e}var I={name:"curl",async execute(s,t){if(y(s))return T(O);let r=S(s);if("exitCode"in r)return r;let e=r;if(!e.url)return{stdout:"",stderr:`curl: no URL specified
23
+ `,exitCode:2};if(!t.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available
24
+ `,exitCode:1};let i=e.url;i.match(/^https?:\/\//)||(i=`https://${i}`);try{let{body:a,contentType:o}=await F(e,t),n=P(e,o),l=await t.fetch(i,{method:e.method,headers:Object.keys(n).length>0?n:void 0,body:a,followRedirects:e.followRedirects,timeoutMs:e.timeoutMs});if(await W(e,l.headers,t),e.failSilently&&l.status>=400)return{stdout:"",stderr:e.showError||!e.silent?`curl: (22) The requested URL returned error: ${l.status}
25
+ `:"",exitCode:22};let d=$(e,l,i);if(e.outputFile||e.useRemoteName){let p=e.outputFile||E(i),v=t.fs.resolvePath(t.cwd,p);await t.fs.writeFile(v,e.headOnly?"":l.body),e.verbose||(d=""),e.writeOut&&(d=m(e.writeOut,{status:l.status,headers:l.headers,url:l.url,bodyLength:l.body.length}))}return{stdout:d,stderr:"",exitCode:0}}catch(a){let o=b(a),n=1;return o.includes("Network access denied")?n=7:o.includes("HTTP method")&&o.includes("not allowed")?n=3:o.includes("Redirect target not in allow-list")||o.includes("Too many redirects")?n=47:o.includes("aborted")&&(n=28),{stdout:"",stderr:!e.silent||e.showError?`curl: (${n}) ${o}
26
+ `:"",exitCode:n}}}};export{I as curlCommand};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{b as x}from"./chunk-J7MJV6WO.js";import{a as y,b as I,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var W={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function k(t){let c=[],l=t.split(",");for(let n of l)if(n.includes("-")){let[s,r]=n.split("-");c.push({start:s?parseInt(s,10):1,end:r?parseInt(r,10):null})}else{let s=parseInt(n,10);c.push({start:s,end:s})}return c}function C(t,c){let l=[];for(let n of c){let s=n.start-1,r=n.end===null?t.length:n.end;for(let i=s;i<r&&i<t.length;i++)i>=0&&!l.includes(t[i])&&l.push(t[i])}return l}var E={name:"cut",async execute(t,c){if(I(t))return y(W);let l=" ",n=null,s=null,r=!1,i=[];for(let o=0;o<t.length;o++){let e=t[o];if(e==="-d")l=t[++o]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")n=t[++o];else if(e.startsWith("-f"))n=e.slice(2);else if(e==="-c")s=t[++o];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")r=!0;else{if(e.startsWith("--"))return m("cut",e);if(e.startsWith("-")){let f=!1;for(let u of e.slice(1))if(u==="s")r=!0;else if(!"dfc".includes(u)){f=!0;break}if(f)return m("cut",e)}else i.push(e)}}if(!n&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
3
+ `,exitCode:1};let p=await x(c,i,{cmdName:"cut"});if(!p.ok)return p.error;let a=p.content.split(`
4
+ `);a.length>0&&a[a.length-1]===""&&a.pop();let g=k(n||s||"1"),h="";for(let o of a)if(s){let e=o.split(""),f=[];for(let u of g){let w=u.start-1,L=u.end===null?e.length:u.end;for(let d=w;d<L&&d<e.length;d++)d>=0&&f.push(e[d])}h+=`${f.join("")}
5
+ `}else{if(r&&!o.includes(l))continue;let e=o.split(l),f=C(e,g);h+=`${f.join(l)}
6
+ `}return{stdout:h,stderr:"",exitCode:0}}};export{E as cutCommand};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{a as g,b as k,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var p={name:"date",summary:"display the current time in the given FORMAT",usage:"date [OPTION]... [+FORMAT]",options:["-d, --date=STRING display time described by STRING","-u, --utc print Coordinated Universal Time (UTC)","-I, --iso-8601 output date/time in ISO 8601 format","-R, --rfc-email output RFC 5322 date format"," --help display this help and exit"]},M=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function n(t,i=2){return String(t).padStart(i,"0")}function T(t){let i=-t.getTimezoneOffset();return`${i>=0?"+":"-"}${n(Math.floor(Math.abs(i)/60))}${n(Math.abs(i)%60)}`}function d(t,i,r){let a=r?{Y:t.getUTCFullYear(),m:t.getUTCMonth(),D:t.getUTCDate(),H:t.getUTCHours(),M:t.getUTCMinutes(),S:t.getUTCSeconds(),w:t.getUTCDay()}:{Y:t.getFullYear(),m:t.getMonth(),D:t.getDate(),H:t.getHours(),M:t.getMinutes(),S:t.getSeconds(),w:t.getDay()},e="",o=0;for(;o<i.length;){if(i[o]==="%"&&o+1<i.length){let c=i[++o];switch(c){case"%":e+="%";break;case"a":e+=M[a.w];break;case"b":case"h":e+=h[a.m];break;case"d":e+=n(a.D);break;case"e":e+=String(a.D).padStart(2," ");break;case"F":e+=`${a.Y}-${n(a.m+1)}-${n(a.D)}`;break;case"H":e+=n(a.H);break;case"I":e+=n(a.H%12||12);break;case"m":e+=n(a.m+1);break;case"M":e+=n(a.M);break;case"n":e+=`
3
+ `;break;case"p":e+=a.H<12?"AM":"PM";break;case"P":e+=a.H<12?"am":"pm";break;case"R":e+=`${n(a.H)}:${n(a.M)}`;break;case"s":e+=Math.floor(t.getTime()/1e3);break;case"S":e+=n(a.S);break;case"t":e+=" ";break;case"T":e+=`${n(a.H)}:${n(a.M)}:${n(a.S)}`;break;case"u":e+=a.w||7;break;case"w":e+=a.w;break;case"y":e+=n(a.Y%100);break;case"Y":e+=a.Y;break;case"z":e+=r?"+0000":T(t);break;case"Z":e+=r?"UTC":Intl.DateTimeFormat().resolvedOptions().timeZone;break;default:e+=`%${c}`}}else e+=i[o];o++}return e}function S(t){let i=new Date(t);if(!Number.isNaN(i.getTime()))return i;if(/^\d+$/.test(t))return new Date(Number.parseInt(t,10)*1e3);let r=t.toLowerCase();return r==="now"||r==="today"?new Date:r==="yesterday"?new Date(Date.now()-864e5):r==="tomorrow"?new Date(Date.now()+864e5):null}var w={name:"date",async execute(t,i){if(k(t))return g(p);let r=!1,a=null,e=null,o=!1,c=!1;for(let f=0;f<t.length;f++){let s=t[f];if(s==="-u"||s==="--utc")r=!0;else if(s==="-d"||s==="--date")a=t[++f]??"";else if(s.startsWith("--date="))a=s.slice(7);else if(s==="-I"||s==="--iso-8601")o=!0;else if(s==="-R"||s==="--rfc-email")c=!0;else if(s.startsWith("+"))e=s.slice(1);else{if(s.startsWith("--"))return m("date",s);if(s.startsWith("-"))for(let b of s.slice(1))if(b==="u")r=!0;else if(b==="I")o=!0;else if(b==="R")c=!0;else return m("date",`-${b}`)}}let l=a!==null?S(a):new Date;if(!l)return{stdout:"",stderr:`date: invalid date '${a}'
4
+ `,exitCode:1};let u;return e?u=d(l,e,r):o?u=d(l,"%Y-%m-%dT%H:%M:%S%z",r):c?u=d(l,"%a, %d %b %Y %H:%M:%S %z",r):u=d(l,"%a %b %e %H:%M:%S %Z %Y",r),{stdout:`${u}
5
+ `,stderr:"",exitCode:0}}};export{w as dateCommand};
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ import{a as N}from"./chunk-TA7RUHGQ.js";import{a as S,b as E}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var v=class{diff(e,t,n={}){let s;typeof n=="function"?(s=n,n={}):"callback"in n&&(s=n.callback);let u=this.castInput(e,n),f=this.castInput(t,n),i=this.removeEmpty(this.tokenize(u,n)),a=this.removeEmpty(this.tokenize(f,n));return this.diffWithOptionsObj(i,a,n,s)}diffWithOptionsObj(e,t,n,s){var u;let f=r=>{if(r=this.postProcess(r,n),s){setTimeout(function(){s(r)},0);return}else return r},i=t.length,a=e.length,d=1,o=i+a;n.maxEditLength!=null&&(o=Math.min(o,n.maxEditLength));let g=(u=n.timeout)!==null&&u!==void 0?u:1/0,w=Date.now()+g,m=[{oldPos:-1,lastComponent:void 0}],P=this.extractCommon(m[0],t,e,0,n);if(m[0].oldPos+1>=a&&P+1>=i)return f(this.buildValues(m[0].lastComponent,t,e));let C=-1/0,x=1/0,L=()=>{for(let r=Math.max(C,-d);r<=Math.min(x,d);r+=2){let c,h=m[r-1],p=m[r+1];h&&(m[r-1]=void 0);let y=!1;if(p){let I=p.oldPos-r;y=p&&0<=I&&I<i}let b=h&&h.oldPos+1<a;if(!y&&!b){m[r]=void 0;continue}if(!b||y&&h.oldPos<p.oldPos?c=this.addToPath(p,!0,!1,0,n):c=this.addToPath(h,!1,!0,1,n),P=this.extractCommon(c,t,e,r,n),c.oldPos+1>=a&&P+1>=i)return f(this.buildValues(c.lastComponent,t,e))||!0;m[r]=c,c.oldPos+1>=a&&(x=Math.min(x,r-1)),P+1>=i&&(C=Math.max(C,r+1))}d++};if(s)(function r(){setTimeout(function(){if(d>o||Date.now()>w)return s(void 0);L()||r()},0)})();else for(;d<=o&&Date.now()<=w;){let r=L();if(r)return r}}addToPath(e,t,n,s,u){let f=e.lastComponent;return f&&!u.oneChangePerToken&&f.added===t&&f.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:f.count+1,added:t,removed:n,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:t,removed:n,previousComponent:f}}}extractCommon(e,t,n,s,u){let f=t.length,i=n.length,a=e.oldPos,d=a-s,o=0;for(;d+1<f&&a+1<i&&this.equals(n[a+1],t[d+1],u);)d++,a++,o++,u.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return o&&!u.oneChangePerToken&&(e.lastComponent={count:o,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,d}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let s=[],u;for(;e;)s.push(e),u=e.previousComponent,delete e.previousComponent,e=u;s.reverse();let f=s.length,i=0,a=0,d=0;for(;i<f;i++){let o=s[i];if(o.removed)o.value=this.join(n.slice(d,d+o.count)),d+=o.count;else{if(!o.added&&this.useLongestToken){let g=t.slice(a,a+o.count);g=g.map(function(w,m){let P=n[d+m];return P.length>w.length?P:w}),o.value=this.join(g)}else o.value=this.join(t.slice(a,a+o.count));a+=o.count,o.added||(d+=o.count)}}return s}};var T=class extends v{constructor(){super(...arguments),this.tokenize=W}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
3
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
4
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
5
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
6
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},O=new T;function D(l,e,t){return O.diff(l,e,t)}function W(l,e){e.stripTrailingCr&&(l=l.replace(/\r\n/g,`
7
+ `));let t=[],n=l.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let s=0;s<n.length;s++){let u=n[s];s%2&&!e.newlineIsToken?t[t.length-1]+=u:t.push(u)}return t}function j(l,e,t,n,s,u,f){let i;f?typeof f=="function"?i={callback:f}:i=f:i={},typeof i.context>"u"&&(i.context=4);let a=i.context;if(i.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(i.callback){let{callback:o}=i;D(t,n,Object.assign(Object.assign({},i),{callback:g=>{let w=d(g);o(w)}}))}else return d(D(t,n,i));function d(o){if(!o)return;o.push({value:"",lines:[]});function g(r){return r.map(function(c){return" "+c})}let w=[],m=0,P=0,C=[],x=1,L=1;for(let r=0;r<o.length;r++){let c=o[r],h=c.lines||A(c.value);if(c.lines=h,c.added||c.removed){if(!m){let p=o[r-1];m=x,P=L,p&&(C=a>0?g(p.lines.slice(-a)):[],m-=C.length,P-=C.length)}for(let p of h)C.push((c.added?"+":"-")+p);c.added?L+=h.length:x+=h.length}else{if(m)if(h.length<=a*2&&r<o.length-2)for(let p of g(h))C.push(p);else{let p=Math.min(h.length,a);for(let b of g(h.slice(0,p)))C.push(b);let y={oldStart:m,oldLines:x-m+p,newStart:P,newLines:L-P+p,lines:C};w.push(y),m=0,P=0,C=[]}x+=h.length,L+=h.length}}for(let r of w)for(let c=0;c<r.lines.length;c++)r.lines[c].endsWith(`
8
+ `)?r.lines[c]=r.lines[c].slice(0,-1):(r.lines.splice(c+1,0,"\"),c++);return{oldFileName:l,newFileName:e,oldHeader:s,newHeader:u,hunks:w}}}function k(l){if(Array.isArray(l))return l.map(k).join(`
9
+ `);let e=[];l.oldFileName==l.newFileName&&e.push("Index: "+l.oldFileName),e.push("==================================================================="),e.push("--- "+l.oldFileName+(typeof l.oldHeader>"u"?"":" "+l.oldHeader)),e.push("+++ "+l.newFileName+(typeof l.newHeader>"u"?"":" "+l.newHeader));for(let t=0;t<l.hunks.length;t++){let n=l.hunks[t];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),e.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@");for(let s of n.lines)e.push(s)}return e.join(`
10
+ `)+`
11
+ `}function F(l,e,t,n,s,u,f){if(typeof f=="function"&&(f={callback:f}),f?.callback){let{callback:i}=f;j(l,e,t,n,s,u,Object.assign(Object.assign({},f),{callback:a=>{i(a?k(a):void 0)}}))}else{let i=j(l,e,t,n,s,u,f);return i?k(i):void 0}}function A(l){let e=l.endsWith(`
12
+ `),t=l.split(`
13
+ `).map(n=>n+`
14
+ `);return e?t.pop():t.push(t.pop().slice(0,-1)),t}var z={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:["-u, --unified output unified diff format (default)","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences"," --help display this help and exit"]},H={unified:{short:"u",long:"unified",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"}},K={name:"diff",async execute(l,e){if(E(l))return S(z);let t=N("diff",l,H);if(!t.ok)return t.error;let n=t.result.flags.brief,s=t.result.flags.reportSame,u=t.result.flags.ignoreCase,f=t.result.positional;if(t.result.flags.unified,f.length<2)return{stdout:"",stderr:`diff: missing operand
15
+ `,exitCode:2};let i,a,[d,o]=f;try{i=d==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,d))}catch{return{stdout:"",stderr:`diff: ${d}: No such file or directory
16
+ `,exitCode:2}}try{a=o==="-"?e.stdin:await e.fs.readFile(e.fs.resolvePath(e.cwd,o))}catch{return{stdout:"",stderr:`diff: ${o}: No such file or directory
17
+ `,exitCode:2}}let g=i,w=a;return u&&(g=g.toLowerCase(),w=w.toLowerCase()),g===w?s?{stdout:`Files ${d} and ${o} are identical
18
+ `,stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0}:n?{stdout:`Files ${d} and ${o} differ
19
+ `,stderr:"",exitCode:1}:{stdout:F(d,o,i,a,"","",{context:3}),stderr:"",exitCode:1}}};export{K as diffCommand};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{a as i,b as o}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var m={name:"dirname",summary:"strip last component from file name",usage:"dirname [OPTION] NAME...",options:[" --help display this help and exit"]},p={name:"dirname",async execute(t,l){if(o(t))return i(m);let a=t.filter(n=>!n.startsWith("-"));if(a.length===0)return{stdout:"",stderr:`dirname: missing operand
3
+ `,exitCode:1};let e=[];for(let n of a){let r=n.replace(/\/+$/,""),s=r.lastIndexOf("/");s===-1?e.push("."):s===0?e.push("/"):e.push(r.slice(0,s))}return{stdout:`${e.join(`
4
+ `)}
5
+ `,stderr:"",exitCode:0}}};export{p as dirnameCommand};
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import{a as z}from"./chunk-TA7RUHGQ.js";import{a as p,b as g}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var $={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},D={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},F={name:"du",async execute(t,l){if(g(t))return p($);let a=z("du",t,D);if(!a.ok)return a.error;let e={allFiles:a.result.flags.allFiles,humanReadable:a.result.flags.humanReadable,summarize:a.result.flags.summarize,grandTotal:a.result.flags.grandTotal,maxDepth:a.result.flags.maxDepth??null},s=a.result.positional;s.length===0&&s.push(".");let r="",n="",m=0;for(let o of s){let i=l.fs.resolvePath(l.cwd,o);try{await l.fs.stat(i);let u=await y(l,i,o,e,0);r+=u.output,m+=u.totalSize,n+=u.stderr}catch{n+=`du: cannot access '${o}': No such file or directory
3
+ `}}return e.grandTotal&&s.length>0&&(r+=`${d(m,e.humanReadable)} total
4
+ `),{stdout:r,stderr:n,exitCode:n?1:0}}};async function y(t,l,a,e,s){let r={output:"",totalSize:0,stderr:""};try{let n=await t.fs.stat(l);if(!n.isDirectory)return r.totalSize=n.size,(e.allFiles||s===0)&&(r.output=d(n.size,e.humanReadable)+" "+a+`
5
+ `),r;let m=await t.fs.readdir(l),o=0;for(let i of m){let u=l==="/"?`/${i}`:`${l}/${i}`,f=a==="."?i:`${a}/${i}`;try{let c=await t.fs.stat(u);if(c.isDirectory){let h=await y(t,u,f,e,s+1);o+=h.totalSize,e.summarize||(e.maxDepth===null||s+1<=e.maxDepth?r.output+=h.output:o+=0)}else o+=c.size,e.allFiles&&!e.summarize&&(r.output+=d(c.size,e.humanReadable)+" "+f+`
6
+ `)}catch{}}r.totalSize=o,(e.summarize||e.maxDepth===null||s<=e.maxDepth)&&(r.output+=`${d(o,e.humanReadable)} ${a}
7
+ `)}catch{r.stderr=`du: cannot read directory '${a}': Permission denied
8
+ `}return r}function d(t,l){return l?t<1024?`${t}`:t<1024*1024?`${(t/1024).toFixed(1)}K`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)}M`:`${(t/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(t/1024)||1)}export{F as duCommand};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import"./chunk-5KNEBKYN.js";function o(a){let s="",e=0;for(;e<a.length;)if(a[e]==="\\"){if(e+1>=a.length){s+="\\";break}let c=a[e+1];switch(c){case"\\":s+="\\",e+=2;break;case"n":s+=`
3
+ `,e+=2;break;case"t":s+=" ",e+=2;break;case"r":s+="\r",e+=2;break;case"a":s+="\x07",e+=2;break;case"b":s+="\b",e+=2;break;case"f":s+="\f",e+=2;break;case"v":s+="\v",e+=2;break;case"e":case"E":s+="\x1B",e+=2;break;case"c":return{output:s,stop:!0};case"0":{let r="",t=e+2;for(;t<a.length&&t<e+5&&/[0-7]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\0";else{let l=parseInt(r,8)%256;s+=String.fromCharCode(l)}e=t;break}case"x":{let r="",t=e+2;for(;t<a.length&&t<e+4&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\x",e+=2;else{let l=parseInt(r,16);s+=String.fromCharCode(l),e=t}break}case"u":{let r="",t=e+2;for(;t<a.length&&t<e+6&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\u",e+=2;else{let l=parseInt(r,16);s+=String.fromCodePoint(l),e=t}break}case"U":{let r="",t=e+2;for(;t<a.length&&t<e+10&&/[0-9a-fA-F]/.test(a[t]);)r+=a[t],t++;if(r.length===0)s+="\\U",e+=2;else{let l=parseInt(r,16);try{s+=String.fromCodePoint(l)}catch{s+=`\\U${r}`}e=t}break}default:s+=`\\${c}`,e+=2}}else s+=a[e],e++;return{output:s,stop:!1}}var n={name:"echo",async execute(a,s){let e=!1,c=!1,r=0;for(;r<a.length;){let l=a[r];if(l==="-n")e=!0,r++;else if(l==="-e")c=!0,r++;else if(l==="-E")c=!1,r++;else if(l==="-ne"||l==="-en")e=!0,c=!0,r++;else break}let t=a.slice(r).join(" ");if(c){let l=o(t);if(t=l.output,l.stop)return{stdout:t,stderr:"",exitCode:0}}return e||(t+=`
4
+ `),{stdout:t,stderr:"",exitCode:0}}};export{n as echoCommand};
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import{a as m,b as f,c as p}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var O={name:"env",summary:"run a program in a modified environment",usage:"env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]",options:["-i, --ignore-environment start with an empty environment","-u NAME, --unset=NAME remove NAME from the environment"," --help display this help and exit"]},y={name:"env",async execute(s,r){if(f(s))return m(O);let u=!1,i=[],l={},t=-1;for(let n=0;n<s.length;n++){let e=s[n];if(e==="-i"||e==="--ignore-environment")u=!0;else if(e==="-u"&&n+1<s.length)i.push(s[++n]);else if(e.startsWith("-u"))i.push(e.slice(2));else if(e.startsWith("--unset="))i.push(e.slice(8));else{if(e.startsWith("--")&&e!=="--")return p("env",e);if(e.startsWith("-")&&e!=="-"){for(let o of e.slice(1))if(o!=="i"&&o!=="u")return p("env",`-${o}`);e.includes("i")&&(u=!0)}else if(e.includes("=")&&t===-1){let o=e.indexOf("="),h=e.slice(0,o),x=e.slice(o+1);l[h]=x}else{t=n;break}}}let a;if(u)a={...l};else{a={...r.env};for(let n of i)delete a[n];Object.assign(a,l)}if(t===-1){let n=[];for(let[e,o]of Object.entries(a))n.push(`${e}=${o}`);return{stdout:n.join(`
3
+ `)+(n.length>0?`
4
+ `:""),stderr:"",exitCode:0}}if(!r.exec)return{stdout:"",stderr:`env: command execution not supported in this context
5
+ `,exitCode:1};let c=s.slice(t).join(" "),v=Object.entries(l).map(([n,e])=>`${n}="${e}"`).join(" "),d=v?`${v} ${c}`:c;return r.exec(d)}},g={name:"printenv",summary:"print all or part of environment",usage:"printenv [OPTION]... [VARIABLE]...",options:[" --help display this help and exit"]},A={name:"printenv",async execute(s,r){if(f(s))return m(g);let u=s.filter(t=>!t.startsWith("-"));if(u.length===0){let t=[];for(let[a,c]of Object.entries(r.env))t.push(`${a}=${c}`);return{stdout:t.join(`
6
+ `)+(t.length>0?`
7
+ `:""),stderr:"",exitCode:0}}let i=[],l=0;for(let t of u)t in r.env?i.push(r.env[t]):l=1;return{stdout:i.join(`
8
+ `)+(i.length>0?`
9
+ `:""),stderr:"",exitCode:l}}};export{y as envCommand,A as printenvCommand};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import"./chunk-5KNEBKYN.js";var d={name:"expr",async execute(s,r){if(s.length===0)return{stdout:"",stderr:`expr: missing operand
3
+ `,exitCode:2};try{let l=g(s),h=l==="0"||l===""?1:0;return{stdout:`${l}
4
+ `,stderr:"",exitCode:h}}catch(l){return{stdout:"",stderr:`expr: ${l.message}
5
+ `,exitCode:2}}}};function g(s){if(s.length===1)return s[0];let r=0;function l(){let e=h();for(;r<s.length&&s[r]==="|";){r++;let t=h();if(e!=="0"&&e!=="")return e;e=t}return e}function h(){let e=a();for(;r<s.length&&s[r]==="&";){r++;let t=a();(e==="0"||e===""||t==="0"||t==="")&&(e="0")}return e}function a(){let e=p();for(;r<s.length;){let t=s[r];if(["=","!=","<",">","<=",">="].includes(t)){r++;let o=p(),n=parseInt(e,10),i=parseInt(o,10),f=!Number.isNaN(n)&&!Number.isNaN(i),c;t==="="?c=f?n===i:e===o:t==="!="?c=f?n!==i:e!==o:t==="<"?c=f?n<i:e<o:t===">"?c=f?n>i:e>o:t==="<="?c=f?n<=i:e<=o:c=f?n>=i:e>=o,e=c?"1":"0"}else break}return e}function p(){let e=N();for(;r<s.length;){let t=s[r];if(t==="+"||t==="-"){r++;let o=N(),n=parseInt(e,10),i=parseInt(o,10);if(Number.isNaN(n)||Number.isNaN(i))throw new Error("non-integer argument");e=String(t==="+"?n+i:n-i)}else break}return e}function N(){let e=m();for(;r<s.length;){let t=s[r];if(t==="*"||t==="/"||t==="%"){r++;let o=m(),n=parseInt(e,10),i=parseInt(o,10);if(Number.isNaN(n)||Number.isNaN(i))throw new Error("non-integer argument");if((t==="/"||t==="%")&&i===0)throw new Error("division by zero");t==="*"?e=String(n*i):t==="/"?e=String(Math.trunc(n/i)):e=String(n%i)}else break}return e}function m(){let e=u();for(;r<s.length&&s[r]===":";){r++;let t=u(),o=new RegExp(`^${t}`),n=e.match(o);n?e=n[1]!==void 0?n[1]:String(n[0].length):e="0"}return e}function u(){if(r>=s.length)throw new Error("syntax error");let e=s[r];if(e==="match"){r++;let t=u(),o=u(),n=new RegExp(o),i=t.match(n);return i?i[1]!==void 0?i[1]:String(i[0].length):"0"}if(e==="substr"){r++;let t=u(),o=parseInt(u(),10),n=parseInt(u(),10);if(Number.isNaN(o)||Number.isNaN(n))throw new Error("non-integer argument");return t.substring(o-1,o-1+n)}if(e==="index"){r++;let t=u(),o=u();for(let n=0;n<t.length;n++)if(o.includes(t[n]))return String(n+1);return"0"}if(e==="length"){r++;let t=u();return String(t.length)}if(e==="("){r++;let t=l();if(r>=s.length||s[r]!==")")throw new Error("syntax error");return r++,t}return r++,e}return l()}export{d as exprCommand};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import{a as v}from"./chunk-26Q3PZQ6.js";import{a as N,b as C}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";function b(e,o){switch(e.type){case"name":return v(o.name,e.pattern,e.ignoreCase);case"path":return v(o.relativePath,e.pattern,e.ignoreCase);case"type":return e.fileType==="f"?o.isFile:e.fileType==="d"?o.isDirectory:!1;case"empty":return o.isEmpty;case"mtime":{let r=(Date.now()-o.mtime)/(1e3*60*60*24);return e.comparison==="more"?r>e.days:e.comparison==="less"?r<e.days:Math.floor(r)===e.days}case"newer":{let s=o.newerRefTimes.get(e.refPath);return s===void 0?!1:o.mtime>s}case"size":{let s=e.value;switch(e.unit){case"c":s=e.value;break;case"k":s=e.value*1024;break;case"M":s=e.value*1024*1024;break;case"G":s=e.value*1024*1024*1024;break;case"b":s=e.value*512;break}return e.comparison==="more"?o.size>s:e.comparison==="less"?o.size<s:e.unit==="b"?Math.ceil(o.size/512)===e.value:o.size===s}case"perm":{let s=o.mode&511,r=e.mode&511;return e.matchType==="exact"?s===r:e.matchType==="all"?(s&r)===r:(s&r)!==0}case"not":return!b(e.expr,o);case"and":return b(e.left,o)&&b(e.right,o);case"or":return b(e.left,o)||b(e.right,o)}}function P(e){let o=[],s=r=>{r&&(r.type==="newer"?o.push(r.refPath):r.type==="not"?s(r.expr):(r.type==="and"||r.type==="or")&&(s(r.left),s(r.right)))};return s(e),o}function R(e,o){let s=[],r=[],i=o;for(;i<e.length;){let t=e[i];if(t==="-name"&&i+1<e.length)s.push({type:"expr",expr:{type:"name",pattern:e[++i]}});else if(t==="-iname"&&i+1<e.length)s.push({type:"expr",expr:{type:"name",pattern:e[++i],ignoreCase:!0}});else if(t==="-path"&&i+1<e.length)s.push({type:"expr",expr:{type:"path",pattern:e[++i]}});else if(t==="-ipath"&&i+1<e.length)s.push({type:"expr",expr:{type:"path",pattern:e[++i],ignoreCase:!0}});else if(t==="-type"&&i+1<e.length){let n=e[++i];if(n==="f"||n==="d")s.push({type:"expr",expr:{type:"type",fileType:n}});else return{expr:null,pathIndex:i,error:`find: Unknown argument to -type: ${n}
3
+ `,actions:[]}}else if(t==="-empty")s.push({type:"expr",expr:{type:"empty"}});else if(t==="-mtime"&&i+1<e.length){let n=e[++i],p="exact",h=n;n.startsWith("+")?(p="more",h=n.slice(1)):n.startsWith("-")&&(p="less",h=n.slice(1));let u=parseInt(h,10);Number.isNaN(u)||s.push({type:"expr",expr:{type:"mtime",days:u,comparison:p}})}else if(t==="-newer"&&i+1<e.length){let n=e[++i];s.push({type:"expr",expr:{type:"newer",refPath:n}})}else if(t==="-size"&&i+1<e.length){let n=e[++i],p="exact",h=n;n.startsWith("+")?(p="more",h=n.slice(1)):n.startsWith("-")&&(p="less",h=n.slice(1));let u=h.match(/^(\d+)([ckMGb])?$/);if(u){let w=parseInt(u[1],10),x=u[2]||"b";s.push({type:"expr",expr:{type:"size",value:w,unit:x,comparison:p}})}}else if(t==="-perm"&&i+1<e.length){let n=e[++i],p="exact",h=n;n.startsWith("-")?(p="all",h=n.slice(1)):n.startsWith("/")&&(p="any",h=n.slice(1));let u=parseInt(h,8);Number.isNaN(u)||s.push({type:"expr",expr:{type:"perm",mode:u,matchType:p}})}else if(t==="-not"||t==="!")s.push({type:"not"});else if(t==="-o"||t==="-or")s.push({type:"op",op:"or"});else if(t==="-a"||t==="-and")s.push({type:"op",op:"and"});else if(t==="-maxdepth"||t==="-mindepth")i++;else if(t==="-exec"){let n=[];for(i++;i<e.length&&e[i]!==";"&&e[i]!=="+";)n.push(e[i]),i++;if(i>=e.length)return{expr:null,pathIndex:i,error:"find: missing argument to `-exec'\n",actions:[]};let p=e[i]==="+";r.push({type:"exec",command:n,batchMode:p})}else if(t==="-print")r.push({type:"print"});else if(t==="-print0")r.push({type:"print0"});else if(t==="-delete")r.push({type:"delete"});else{if(t.startsWith("-"))return{expr:null,pathIndex:i,error:`find: unknown predicate '${t}'
4
+ `,actions:[]};if(s.length===0){i++;continue}break}i++}if(s.length===0)return{expr:null,pathIndex:i,actions:r};let g=[];for(let t=0;t<s.length;t++){let n=s[t];if(n.type==="not"){if(t+1<s.length&&s[t+1].type==="expr"){let p=s[t+1].expr;g.push({type:"expr",expr:{type:"not",expr:p}}),t++}}else(n.type==="expr"||n.type==="op")&&g.push(n)}let E=[[]];for(let t of g)t.type==="op"&&t.op==="or"?E.push([]):t.type==="expr"&&E[E.length-1].push(t.expr);let y=[];for(let t of E){if(t.length===0)continue;let n=t[0];for(let p=1;p<t.length;p++)n={type:"and",left:n,right:t[p]};y.push(n)}if(y.length===0)return{expr:null,pathIndex:i,actions:r};let T=y[0];for(let t=1;t<y.length;t++)T={type:"or",left:T,right:y[t]};return{expr:T,pathIndex:i,actions:r}}var $={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","-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","-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","-delete delete found files/directories"," --help display this help and exit"]},A=new Set(["-name","-iname","-path","-ipath","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),G={name:"find",async execute(e,o){if(C(e))return N($);let s=".",r=null,i=null;for(let l=0;l<e.length;l++){let a=e[l];if(a==="-maxdepth"&&l+1<e.length)r=parseInt(e[++l],10);else if(a==="-mindepth"&&l+1<e.length)i=parseInt(e[++l],10);else if(a==="-exec")for(l++;l<e.length&&e[l]!==";"&&e[l]!=="+";)l++;else!a.startsWith("-")&&a!==";"&&a!=="+"?s=a:A.has(a)&&l++}let{expr:g,error:E,actions:y}=R(e,0);if(E)return{stdout:"",stderr:E,exitCode:1};let T=y.length===0,t=o.fs.resolvePath(o.cwd,s);try{await o.fs.stat(t)}catch{return{stdout:"",stderr:`find: ${s}: No such file or directory
5
+ `,exitCode:1}}let n=[],p=P(g),h=new Map;for(let l of p){let a=o.fs.resolvePath(o.cwd,l);try{let f=await o.fs.stat(a);h.set(l,f.mtime?.getTime()??Date.now())}catch{}}async function u(l,a){if(r!==null&&a>r)return;let f;try{f=await o.fs.stat(l)}catch{return}if(!f)return;let m;l===t?m=s.split("/").pop()||s:m=l.split("/").pop()||"";let c=l===t?s:s==="."?`./${l.slice(t.length+1)}`:s+l.slice(t.length),d=null;f.isDirectory&&(d=await o.fs.readdir(l));let z=f.isFile?f.size===0:d!==null&&d.length===0,D=i===null||a>=i;if(D&&g!==null){let k={name:m,relativePath:c,isFile:f.isFile,isDirectory:f.isDirectory,isEmpty:z,mtime:f.mtime?.getTime()??Date.now(),size:f.size??0,mode:f.mode??420,newerRefTimes:h};D=b(g,k)}if(D&&n.push(c),d!==null)for(let k of d){let I=l==="/"?`/${k}`:`${l}/${k}`;await u(I,a+1)}}await u(t,0);let w="",x="",M=0;if(y.length>0)for(let l of y)switch(l.type){case"print":w+=n.length>0?`${n.join(`
6
+ `)}
7
+ `:"";break;case"print0":w+=n.length>0?`${n.join("\0")}\0`:"";break;case"delete":{let a=[...n].sort((f,m)=>m.length-f.length);for(let f of a){let m=o.fs.resolvePath(o.cwd,f);try{await o.fs.rm(m,{recursive:!1})}catch(c){let d=c instanceof Error?c.message:String(c);x+=`find: cannot delete '${f}': ${d}
8
+ `,M=1}}break}case"exec":if(!o.exec)return{stdout:"",stderr:`find: -exec not supported in this context
9
+ `,exitCode:1};if(l.batchMode){let a=[];for(let c of l.command)c==="{}"?a.push(...n):a.push(c);let f=a.map(c=>`"${c}"`).join(" "),m=await o.exec(f);w+=m.stdout,x+=m.stderr,m.exitCode!==0&&(M=m.exitCode)}else for(let a of n){let m=l.command.map(d=>d==="{}"?a:d).map(d=>`"${d}"`).join(" "),c=await o.exec(m);w+=c.stdout,x+=c.stderr,c.exitCode!==0&&(M=c.exitCode)}break}else T&&(w=n.length>0?`${n.join(`
10
+ `)}
11
+ `:"");return{stdout:w,stderr:x,exitCode:M}}};export{G as findCommand};
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import{a as N}from"./chunk-26Q3PZQ6.js";import{a as q,b as G,c as O}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var j={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},k={name:"grep",async execute(s,e){if(G(s))return q(j);let o=!1,r=!1,f=!1,u=!1,w=!1,p=!1,h=!1,d=!1,g=!1,m=!1,y=!1,L=!1,x=!1,v=0,l=0,C=[],i=[],n=[],I=null,P=[];for(let a=0;a<s.length;a++){let c=s[a];if(c.startsWith("-")&&c!=="-"){if(c==="-e"&&a+1<s.length){I=s[++a];continue}if(c.startsWith("--include=")){C.push(c.slice(10));continue}if(c.startsWith("--exclude=")){i.push(c.slice(10));continue}if(c.startsWith("--exclude-dir=")){n.push(c.slice(14));continue}let $=c.match(/^-([ABC])(\d+)$/);if($){let t=parseInt($[2],10);$[1]==="A"?l=t:$[1]==="B"?v=t:$[1]==="C"&&(v=t,l=t);continue}if((c==="-A"||c==="-B"||c==="-C")&&a+1<s.length){let t=parseInt(s[++a],10);c==="-A"?l=t:c==="-B"?v=t:(v=t,l=t);continue}let A=c.startsWith("--")?[c]:c.slice(1).split("");for(let t of A)if(t==="i"||t==="--ignore-case")o=!0;else if(t==="n"||t==="--line-number")r=!0;else if(t==="v"||t==="--invert-match")f=!0;else if(t==="c"||t==="--count")u=!0;else if(t==="l"||t==="--files-with-matches")w=!0;else if(t==="L"||t==="--files-without-match")p=!0;else if(t==="r"||t==="R"||t==="--recursive")h=!0;else if(t==="w"||t==="--word-regexp")d=!0;else if(t==="E"||t==="--extended-regexp")g=!0;else if(t==="F"||t==="--fixed-strings")m=!0;else if(t==="o"||t==="--only-matching")y=!0;else if(t==="h"||t==="--no-filename")L=!0;else if(t==="q"||t==="--quiet"||t==="--silent")x=!0;else{if(t.startsWith("--"))return O("grep",t);if(t.length===1)return O("grep",`-${t}`)}}else I===null?I=c:P.push(c)}if(I===null)return{stdout:"",stderr:`grep: missing pattern
3
+ `,exitCode:2};let R;m?R=I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):g?R=I:R=z(I),d&&(R=`\\b${R}\\b`);let B;try{B=new RegExp(R,o?"gi":"g")}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${I}
4
+ `,exitCode:2}}if(P.length===0&&e.stdin){let a=b(e.stdin,B,f,r,u,"",y,v,l);return x?{stdout:"",stderr:"",exitCode:a.matched?0:1}:{stdout:a.output,stderr:"",exitCode:a.matched?0:1}}if(P.length===0)return{stdout:"",stderr:`grep: no input files
5
+ `,exitCode:2};let E="",W="",Q=!1,U=!1,M=[];for(let a of P)if(a.includes("*")||a.includes("?")||a.includes("[")){let c=await J(a,e);if(h)for(let $ of c){let A=await S($,e,C,i,n);M.push(...A)}else M.push(...c)}else if(h){let c=await S(a,e,C,i,n);M.push(...c)}else M.push(a);let H=(M.length>1||h)&&!L;for(let a of M){let c=a.split("/").pop()||a;if(!(i.length>0&&!h&&i.some($=>N(c,$,{stripQuotes:!0})))&&!(C.length>0&&!h&&!C.some($=>N(c,$,{stripQuotes:!0}))))try{let $=e.fs.resolvePath(e.cwd,a);if((await e.fs.stat($)).isDirectory){h||(W+=`grep: ${a}: Is a directory
6
+ `);continue}let t=await e.fs.readFile($),F=b(t,B,f,r,u,H?a:"",y,v,l);if(F.matched){if(Q=!0,x)return{stdout:"",stderr:"",exitCode:0};w?E+=`${a}
7
+ `:p||(E+=F.output)}else p?E+=`${a}
8
+ `:u&&!w&&(E+=F.output)}catch{W+=`grep: ${a}: No such file or directory
9
+ `,U=!0}}let T;return U?T=2:p?T=E.length>0?0:1:T=Q?0:1,x?{stdout:"",stderr:"",exitCode:T}:{stdout:E,stderr:W,exitCode:T}}};function z(s){let e="",o=0;for(;o<s.length;){let r=s[o];if(r==="\\"&&o+1<s.length){let f=s[o+1];if(f==="|"||f==="("||f===")"){e+=f,o+=2;continue}else if(f==="{"||f==="}"){e+=`\\${f}`,o+=2;continue}}r==="+"||r==="?"||r==="|"||r==="("||r===")"||r==="{"||r==="}"?e+=`\\${r}`:e+=r,o++}return e}function b(s,e,o,r,f,u,w=!1,p=0,h=0){let d=s.split(`
10
+ `),g=d.length,m=g>0&&d[g-1]===""?g-1:g;if(f){let l=0;for(let i=0;i<m;i++)e.lastIndex=0,e.test(d[i])!==o&&l++;return{output:`${u?`${u}:${l}`:String(l)}
11
+ `,matched:l>0}}if(p===0&&h===0){let l=[],C=!1;for(let i=0;i<m;i++){let n=d[i];if(e.lastIndex=0,e.test(n)!==o)if(C=!0,w){e.lastIndex=0;for(let P=e.exec(n);P!==null;P=e.exec(n))l.push(u?`${u}:${P[0]}`:P[0]),P[0].length===0&&e.lastIndex++}else r?l.push(u?`${u}:${i+1}:${n}`:`${i+1}:${n}`):l.push(u?`${u}:${n}`:n)}return{output:l.length>0?`${l.join(`
12
+ `)}
13
+ `:"",matched:C}}let y=[],L=0,x=new Set,v=[];for(let l=0;l<m;l++)e.lastIndex=0,e.test(d[l])!==o&&(v.push(l),L++);for(let l of v){for(let i=Math.max(0,l-p);i<l;i++)if(!x.has(i)){x.add(i);let n=d[i];r&&(n=`${i+1}-${n}`),u&&(n=`${u}-${n}`),y.push(n)}if(!x.has(l)){x.add(l);let i=d[l];if(w){e.lastIndex=0;for(let n=e.exec(i);n!==null;n=e.exec(i))y.push(u?`${u}:${n[0]}`:n[0]),n[0].length===0&&e.lastIndex++}else{let n=i;r&&(n=`${l+1}:${n}`),u&&(n=`${u}:${n}`),y.push(n)}}let C=Math.min(m-1,l+h);for(let i=l+1;i<=C;i++)if(!x.has(i)){x.add(i);let n=d[i];r&&(n=`${i+1}-${n}`),u&&(n=`${u}-${n}`),y.push(n)}}return{output:y.length>0?`${y.join(`
14
+ `)}
15
+ `:"",matched:L>0}}async function S(s,e,o=[],r=[],f=[]){let u=e.fs.resolvePath(e.cwd,s),w=[];try{if(!(await e.fs.stat(u)).isDirectory){let g=s.split("/").pop()||s;return r.length>0&&r.some(m=>N(g,m,{stripQuotes:!0}))?[]:o.length>0&&!o.some(m=>N(g,m,{stripQuotes:!0}))?[]:[s]}let h=s.split("/").pop()||s;if(f.length>0&&f.some(g=>N(h,g,{stripQuotes:!0})))return[];let d=await e.fs.readdir(u);for(let g of d){if(g.startsWith("."))continue;let m=s==="."?g:`${s}/${g}`,y=await S(m,e,o,r,f);w.push(...y)}}catch{}return w}async function J(s,e){let o=[],r=s.lastIndexOf("/"),f,u;if(r===-1?(f=e.cwd,u=s):(f=s.slice(0,r)||"/",u=s.slice(r+1)),s.includes("**")){let p=s.split("**"),h=p[0].replace(/\/$/,"")||".",d=p[1]||"";return await D(h,d,e,o),o}let w=e.fs.resolvePath(e.cwd,f);try{let p=await e.fs.readdir(w);for(let h of p)if(N(h,u,{stripQuotes:!0})){let d=r===-1?h:`${f}/${h}`;o.push(d)}}catch{}return o.sort()}async function D(s,e,o,r){let f=o.fs.resolvePath(o.cwd,s);try{if(!(await o.fs.stat(f)).isDirectory){let p=s.split("/").pop()||"";if(e){let h=e.replace(/^\//,"");N(p,h,{stripQuotes:!0})&&r.push(s)}return}let w=await o.fs.readdir(f);for(let p of w){let h=s==="."?p:`${s}/${p}`,d=o.fs.resolvePath(o.cwd,h);if((await o.fs.stat(d)).isDirectory)await D(h,e,o,r);else if(e){let m=e.replace(/^\//,"");N(p,m,{stripQuotes:!0})&&r.push(h)}}}catch{}}var X={name:"fgrep",async execute(s,e){return k.execute(["-F",...s],e)}},Y={name:"egrep",async execute(s,e){return k.execute(["-E",...s],e)}};export{Y as egrepCommand,X as fgrepCommand,k as grepCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a as i,b as r,c as n}from"./chunk-J7BCMQDI.js";import{a as t,b as a}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var h={name:"head",summary:"output the first part of files",usage:"head [OPTION]... [FILE]...",options:["-c, --bytes=NUM print the first NUM bytes","-n, --lines=NUM print the first NUM lines (default 10)","-q, --quiet never print headers giving file names","-v, --verbose always print headers giving file names"," --help display this help and exit"]},u={name:"head",async execute(s,o){if(a(s))return t(h);let e=i(s,"head");if(!e.ok)return e.error;let{lines:p,bytes:l}=e.options;return r(o,e.options,"head",d=>n(d,p,l))}};export{u as headCommand};
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import"./chunk-5KNEBKYN.js";var c={"File operations":["ls","cat","head","tail","wc","touch","mkdir","rm","cp","mv","ln","chmod","stat","readlink"],"Text processing":["grep","sed","awk","sort","uniq","cut","tr","tee","diff"],Search:["find"],"Navigation & paths":["pwd","basename","dirname","tree","du"],"Environment & shell":["echo","printf","env","printenv","export","alias","unalias","history","clear","true","false","bash","sh"],"Data processing":["xargs","jq","base64","date"],Network:["curl","html-to-markdown"]};function l(t){let e=[],n=new Set(t);e.push(`Available commands:
3
+ `);let s=[];for(let[o,r]of Object.entries(c)){let a=r.filter(i=>n.has(i));if(a.length>0){e.push(` ${o}:`),e.push(` ${a.join(", ")}
4
+ `);for(let i of a)n.delete(i)}}for(let o of n)s.push(o);return s.length>0&&(e.push(" Other:"),e.push(` ${s.sort().join(", ")}
5
+ `)),e.push("Use '<command> --help' for details on a specific command."),`${e.join(`
6
+ `)}
7
+ `}var d={name:"help",async execute(t,e){if(t.includes("--help")||t.includes("-h"))return{stdout:`help - display available commands
8
+
9
+ Usage: help [command]
10
+
11
+ Options:
12
+ -h, --help Show this help message
13
+
14
+ If a command name is provided, shows help for that command.
15
+ Otherwise, lists all available commands.
16
+ `,stderr:"",exitCode:0};if(t.length>0&&e.exec){let s=t[0];return e.exec(`${s} --help`)}let n=e.getRegisteredCommands?.()??[];return{stdout:l(n),stderr:"",exitCode:0}}};export{d as helpCommand};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{a as i,b as h}from"./chunk-GTNBSMZR.js";import"./chunk-5KNEBKYN.js";var d={name:"history",summary:"display command history",usage:"history [n]",options:["-c clear the history list"," --help display this help and exit"]},l="BASH_HISTORY",m={name:"history",async execute(e,n){if(h(e))return i(d);let a=n.env[l]||"[]",t;try{t=JSON.parse(a)}catch{t=[]}if(e[0]==="-c")return n.env[l]="[]",{stdout:"",stderr:"",exitCode:0};let s=t.length;e[0]&&/^\d+$/.test(e[0])&&(s=Math.min(parseInt(e[0],10),t.length));let c=t.length-s,r="";for(let o=c;o<t.length;o++){let y=(o+1).toString().padStart(5," ");r+=`${y} ${t[o]}
3
+ `}return{stdout:r,stderr:"",exitCode:0}}};export{m as historyCommand};