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,14 @@
1
+ import type { Command } from "../../types.js";
2
+ /**
3
+ * seq - print a sequence of numbers
4
+ *
5
+ * Usage:
6
+ * seq LAST - print numbers from 1 to LAST
7
+ * seq FIRST LAST - print numbers from FIRST to LAST
8
+ * seq FIRST INCR LAST - print numbers from FIRST to LAST by INCR
9
+ *
10
+ * Options:
11
+ * -s STRING use STRING to separate numbers (default: newline)
12
+ * -w equalize width by padding with leading zeros
13
+ */
14
+ export declare const seqCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const sleepCommand: Command;
@@ -0,0 +1,9 @@
1
+ import type { SortOptions } from "./types.js";
2
+ /**
3
+ * Create a comparison function for sorting
4
+ */
5
+ export declare function createComparator(options: SortOptions): (a: string, b: string) => number;
6
+ /**
7
+ * Filter unique lines based on key values or whole line
8
+ */
9
+ export declare function filterUnique(lines: string[], options: SortOptions): string[];
@@ -0,0 +1,11 @@
1
+ import type { KeySpec } from "./types.js";
2
+ /**
3
+ * Parse a key specification like:
4
+ * - "1" - field 1
5
+ * - "1,2" - fields 1 through 2
6
+ * - "1.3" - field 1 starting at char 3
7
+ * - "1.3,2.5" - field 1 char 3 through field 2 char 5
8
+ * - "1n" - field 1, numeric
9
+ * - "1,2nr" - fields 1-2, numeric and reverse
10
+ */
11
+ export declare function parseKeySpec(spec: string): KeySpec | null;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const sortCommand: Command;
@@ -0,0 +1,18 @@
1
+ export interface KeySpec {
2
+ startField: number;
3
+ startChar?: number;
4
+ endField?: number;
5
+ endChar?: number;
6
+ numeric?: boolean;
7
+ reverse?: boolean;
8
+ ignoreCase?: boolean;
9
+ ignoreLeading?: boolean;
10
+ }
11
+ export interface SortOptions {
12
+ reverse: boolean;
13
+ numeric: boolean;
14
+ unique: boolean;
15
+ ignoreCase: boolean;
16
+ keys: KeySpec[];
17
+ fieldDelimiter: string | null;
18
+ }
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const statCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const tailCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const teeCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const timeoutCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const touchCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const trCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const treeCommand: Command;
@@ -0,0 +1,3 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const trueCommand: Command;
3
+ export declare const falseCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const uniqCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const wcCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const whichCommand: Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const xargsCommand: Command;
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Supported buffer encodings
3
+ */
4
+ export type BufferEncoding = "utf8" | "utf-8" | "ascii" | "binary" | "base64" | "hex" | "latin1";
5
+ /**
6
+ * File content can be string or Buffer
7
+ */
8
+ export type FileContent = string | Uint8Array;
9
+ /**
10
+ * Options for reading files
11
+ */
12
+ export interface ReadFileOptions {
13
+ encoding?: BufferEncoding | null;
14
+ }
15
+ /**
16
+ * Options for writing files
17
+ */
18
+ export interface WriteFileOptions {
19
+ encoding?: BufferEncoding;
20
+ }
21
+ /**
22
+ * File system entry types
23
+ */
24
+ export interface FileEntry {
25
+ type: "file";
26
+ content: string | Uint8Array;
27
+ mode: number;
28
+ mtime: Date;
29
+ }
30
+ export interface DirectoryEntry {
31
+ type: "directory";
32
+ mode: number;
33
+ mtime: Date;
34
+ }
35
+ export interface SymlinkEntry {
36
+ type: "symlink";
37
+ target: string;
38
+ mode: number;
39
+ mtime: Date;
40
+ }
41
+ export type FsEntry = FileEntry | DirectoryEntry | SymlinkEntry;
42
+ /**
43
+ * Stat result from the filesystem
44
+ */
45
+ export interface FsStat {
46
+ isFile: boolean;
47
+ isDirectory: boolean;
48
+ isSymbolicLink: boolean;
49
+ mode: number;
50
+ size: number;
51
+ mtime: Date;
52
+ }
53
+ /**
54
+ * Options for mkdir operation
55
+ */
56
+ export interface MkdirOptions {
57
+ recursive?: boolean;
58
+ }
59
+ /**
60
+ * Options for rm operation
61
+ */
62
+ export interface RmOptions {
63
+ recursive?: boolean;
64
+ force?: boolean;
65
+ }
66
+ /**
67
+ * Options for cp operation
68
+ */
69
+ export interface CpOptions {
70
+ recursive?: boolean;
71
+ }
72
+ /**
73
+ * Abstract filesystem interface that can be implemented by different backends.
74
+ * This allows BashEnv to work with:
75
+ * - VirtualFs (in-memory, default)
76
+ * - Real filesystem (via node:fs)
77
+ * - Custom implementations (e.g., remote storage, browser IndexedDB)
78
+ */
79
+ export interface IFileSystem {
80
+ /**
81
+ * Read the contents of a file as a string (default: utf8)
82
+ * @throws Error if file doesn't exist or is a directory
83
+ */
84
+ readFile(path: string, options?: ReadFileOptions | BufferEncoding): Promise<string>;
85
+ /**
86
+ * Read the contents of a file as a Uint8Array (binary)
87
+ * @throws Error if file doesn't exist or is a directory
88
+ */
89
+ readFileBuffer(path: string): Promise<Uint8Array>;
90
+ /**
91
+ * Write content to a file, creating it if it doesn't exist
92
+ */
93
+ writeFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
94
+ /**
95
+ * Append content to a file, creating it if it doesn't exist
96
+ */
97
+ appendFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
98
+ /**
99
+ * Check if a path exists
100
+ */
101
+ exists(path: string): Promise<boolean>;
102
+ /**
103
+ * Get file/directory information
104
+ * @throws Error if path doesn't exist
105
+ */
106
+ stat(path: string): Promise<FsStat>;
107
+ /**
108
+ * Create a directory
109
+ * @throws Error if parent doesn't exist (unless recursive) or path exists
110
+ */
111
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
112
+ /**
113
+ * Read directory contents
114
+ * @returns Array of entry names (not full paths)
115
+ * @throws Error if path doesn't exist or is not a directory
116
+ */
117
+ readdir(path: string): Promise<string[]>;
118
+ /**
119
+ * Remove a file or directory
120
+ * @throws Error if path doesn't exist (unless force) or directory not empty (unless recursive)
121
+ */
122
+ rm(path: string, options?: RmOptions): Promise<void>;
123
+ /**
124
+ * Copy a file or directory
125
+ * @throws Error if source doesn't exist or trying to copy directory without recursive
126
+ */
127
+ cp(src: string, dest: string, options?: CpOptions): Promise<void>;
128
+ /**
129
+ * Move/rename a file or directory
130
+ */
131
+ mv(src: string, dest: string): Promise<void>;
132
+ /**
133
+ * Resolve a relative path against a base path
134
+ */
135
+ resolvePath(base: string, path: string): string;
136
+ /**
137
+ * Get all paths in the filesystem (useful for glob matching)
138
+ * Optional - implementations may return empty array if not supported
139
+ */
140
+ getAllPaths(): string[];
141
+ /**
142
+ * Change file/directory permissions
143
+ * @throws Error if path doesn't exist
144
+ */
145
+ chmod(path: string, mode: number): Promise<void>;
146
+ /**
147
+ * Create a symbolic link
148
+ * @param target - The path the symlink should point to
149
+ * @param linkPath - The path where the symlink will be created
150
+ * @throws Error if linkPath already exists
151
+ */
152
+ symlink(target: string, linkPath: string): Promise<void>;
153
+ /**
154
+ * Create a hard link
155
+ * @param existingPath - The existing file to link to
156
+ * @param newPath - The path where the new link will be created
157
+ * @throws Error if existingPath doesn't exist or newPath already exists
158
+ */
159
+ link(existingPath: string, newPath: string): Promise<void>;
160
+ /**
161
+ * Read the target of a symbolic link
162
+ * @throws Error if path doesn't exist or is not a symlink
163
+ */
164
+ readlink(path: string): Promise<string>;
165
+ /**
166
+ * Get file/directory information without following symlinks
167
+ * @throws Error if path doesn't exist
168
+ */
169
+ lstat(path: string): Promise<FsStat>;
170
+ }
171
+ /**
172
+ * Extended file initialization options with optional metadata
173
+ */
174
+ export interface FileInit {
175
+ content: FileContent;
176
+ mode?: number;
177
+ mtime?: Date;
178
+ }
179
+ /**
180
+ * Initial files can be simple content or extended options with metadata
181
+ */
182
+ export type InitialFiles = Record<string, FileContent | FileInit>;
183
+ /**
184
+ * Factory function type for creating filesystem instances
185
+ */
186
+ export type FileSystemFactory = (initialFiles?: InitialFiles) => IFileSystem;
package/dist/fs.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ import type { BufferEncoding, CpOptions, DirectoryEntry, FileContent, FileEntry, FsEntry, FsStat, IFileSystem, InitialFiles, MkdirOptions, ReadFileOptions, RmOptions, SymlinkEntry, WriteFileOptions } from "./fs-interface.js";
2
+ export type { BufferEncoding, FileContent, FileEntry, DirectoryEntry, SymlinkEntry, FsEntry, FsStat, IFileSystem, ReadFileOptions, WriteFileOptions, };
3
+ export interface FsData {
4
+ [path: string]: FsEntry;
5
+ }
6
+ export declare class VirtualFs implements IFileSystem {
7
+ private data;
8
+ constructor(initialFiles?: InitialFiles);
9
+ private normalizePath;
10
+ private dirname;
11
+ private ensureParentDirs;
12
+ writeFileSync(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding, metadata?: {
13
+ mode?: number;
14
+ mtime?: Date;
15
+ }): void;
16
+ readFile(path: string, options?: ReadFileOptions | BufferEncoding): Promise<string>;
17
+ readFileBuffer(path: string): Promise<Uint8Array>;
18
+ writeFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
19
+ appendFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
20
+ exists(path: string): Promise<boolean>;
21
+ stat(path: string): Promise<FsStat>;
22
+ lstat(path: string): Promise<FsStat>;
23
+ private resolveSymlink;
24
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
25
+ /**
26
+ * Synchronous version of mkdir
27
+ */
28
+ mkdirSync(path: string, options?: MkdirOptions): void;
29
+ readdir(path: string): Promise<string[]>;
30
+ rm(path: string, options?: RmOptions): Promise<void>;
31
+ cp(src: string, dest: string, options?: CpOptions): Promise<void>;
32
+ mv(src: string, dest: string): Promise<void>;
33
+ getAllPaths(): string[];
34
+ resolvePath(base: string, path: string): string;
35
+ chmod(path: string, mode: number): Promise<void>;
36
+ symlink(target: string, linkPath: string): Promise<void>;
37
+ link(existingPath: string, newPath: string): Promise<void>;
38
+ readlink(path: string): Promise<string>;
39
+ }
@@ -0,0 +1,12 @@
1
+ export type { BashOptions, ExecOptions } from "./Bash.js";
2
+ export { Bash } from "./Bash.js";
3
+ export type { AllCommandName, CommandName, NetworkCommandName, } from "./commands/registry.js";
4
+ export { getCommandNames, getNetworkCommandNames, } from "./commands/registry.js";
5
+ export { VirtualFs } from "./fs.js";
6
+ export type { BufferEncoding, CpOptions, DirectoryEntry, FileContent, FileEntry, FileInit, FileSystemFactory, FsEntry, FsStat, InitialFiles, MkdirOptions, RmOptions, SymlinkEntry, } from "./fs-interface.js";
7
+ export type { NetworkConfig } from "./network/index.js";
8
+ export { NetworkAccessDeniedError, RedirectNotAllowedError, TooManyRedirectsError, } from "./network/index.js";
9
+ export { OverlayFs, type OverlayFsOptions } from "./overlay-fs/index.js";
10
+ export type { CommandFinished as SandboxCommandFinished, OutputMessage, SandboxOptions, WriteFilesInput, } from "./sandbox/index.js";
11
+ export { Command as SandboxCommand, Sandbox } from "./sandbox/index.js";
12
+ export type { BashExecResult, Command, CommandContext, ExecResult, IFileSystem, } from "./types.js";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Arithmetic Evaluation
3
+ *
4
+ * Evaluates bash arithmetic expressions including:
5
+ * - Basic operators (+, -, *, /, %)
6
+ * - Comparison operators (<, <=, >, >=, ==, !=)
7
+ * - Bitwise operators (&, |, ^, ~, <<, >>)
8
+ * - Logical operators (&&, ||, !)
9
+ * - Assignment operators (=, +=, -=, etc.)
10
+ * - Ternary operator (? :)
11
+ * - Pre/post increment/decrement (++, --)
12
+ * - Nested arithmetic: $((expr))
13
+ * - Command substitution: $(cmd) or `cmd`
14
+ *
15
+ * Known limitations:
16
+ * - Bitwise operations use JavaScript's 32-bit signed integers, not 64-bit.
17
+ * This means values like (1 << 31) will be negative (-2147483648) instead
18
+ * of the bash 64-bit result (2147483648).
19
+ * - Dynamic arithmetic expressions (e.g., ${base}#a where base=16) are not
20
+ * fully supported - variable expansion happens at parse time, not runtime.
21
+ */
22
+ import type { ArithExpr } from "../ast/types.js";
23
+ import type { InterpreterContext } from "./types.js";
24
+ /**
25
+ * Synchronous version of evaluateArithmetic for simple expressions.
26
+ * Does not support command substitution - those will return 0.
27
+ */
28
+ export declare function evaluateArithmeticSync(ctx: InterpreterContext, expr: ArithExpr): number;
29
+ export declare function evaluateArithmetic(ctx: InterpreterContext, expr: ArithExpr): Promise<number>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * break - Exit from loops builtin
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ export declare function handleBreak(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * cd - Change directory builtin
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ export declare function handleCd(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * continue - Skip to next loop iteration builtin
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ export declare function handleContinue(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * declare/typeset - Declare variables and give them attributes
3
+ *
4
+ * Usage:
5
+ * declare - List all variables
6
+ * declare -p - List all variables (same as no args)
7
+ * declare NAME=value - Declare variable with value
8
+ * declare -a NAME - Declare indexed array
9
+ * declare -A NAME - Declare associative array
10
+ * declare -r NAME - Declare readonly variable
11
+ * declare -x NAME - Export variable
12
+ *
13
+ * Also aliased as 'typeset'
14
+ */
15
+ import type { ExecResult } from "../../types.js";
16
+ import type { InterpreterContext } from "../types.js";
17
+ export declare function handleDeclare(ctx: InterpreterContext, args: string[]): ExecResult;
18
+ /**
19
+ * Parse array elements from content like "1 2 3" or "'a b' c d"
20
+ */
21
+ export declare function parseArrayElements(content: string): string[];
22
+ /**
23
+ * readonly - Declare readonly variables
24
+ *
25
+ * Usage:
26
+ * readonly NAME=value - Declare readonly variable
27
+ * readonly NAME - Mark existing variable as readonly
28
+ */
29
+ export declare function handleReadonly(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * eval - Execute arguments as a shell command
3
+ *
4
+ * Concatenates all arguments and executes them as a shell command
5
+ * in the current environment (variables persist after eval).
6
+ */
7
+ import type { ExecResult } from "../../types.js";
8
+ import type { InterpreterContext } from "../types.js";
9
+ export declare function handleEval(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * exit - Exit shell builtin
3
+ */
4
+ import type { InterpreterContext } from "../types.js";
5
+ export declare function handleExit(ctx: InterpreterContext, args: string[]): never;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * export - Set environment variables builtin
3
+ *
4
+ * Usage:
5
+ * export - List all exported variables
6
+ * export -p - List all exported variables (same as no args)
7
+ * export NAME=value - Set and export variable
8
+ * export NAME - Export existing variable (or create empty)
9
+ * export -n NAME - Un-export variable (remove from env)
10
+ */
11
+ import type { ExecResult } from "../../types.js";
12
+ import type { InterpreterContext } from "../types.js";
13
+ export declare function handleExport(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Built-in Command Handlers
3
+ *
4
+ * Shell built-in commands that modify interpreter state:
5
+ * - cd: Change directory
6
+ * - declare/typeset: Declare variables with attributes
7
+ * - export: Set environment variables
8
+ * - unset: Remove variables/functions
9
+ * - exit: Exit shell
10
+ * - local: Declare local variables in functions
11
+ * - readonly: Declare readonly variables
12
+ * - set: Set/unset shell options
13
+ * - break: Exit from loops
14
+ * - continue: Skip to next loop iteration
15
+ * - return: Return from a function
16
+ * - eval: Execute arguments as a shell command
17
+ * - let: Evaluate arithmetic expressions
18
+ * - shift: Shift positional parameters
19
+ * - read: Read a line of input
20
+ * - source/.: Execute commands from a file in current environment
21
+ */
22
+ export { handleBreak } from "./break.js";
23
+ export { handleCd } from "./cd.js";
24
+ export { handleContinue } from "./continue.js";
25
+ export { handleDeclare, handleReadonly } from "./declare.js";
26
+ export { handleEval } from "./eval.js";
27
+ export { handleExit } from "./exit.js";
28
+ export { handleExport } from "./export.js";
29
+ export { handleLet } from "./let.js";
30
+ export { handleLocal } from "./local.js";
31
+ export { handleRead } from "./read.js";
32
+ export { handleReturn } from "./return.js";
33
+ export { handleSet } from "./set.js";
34
+ export { handleShift } from "./shift.js";
35
+ export { handleSource } from "./source.js";
36
+ export { handleUnset } from "./unset.js";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * let - Evaluate arithmetic expressions
3
+ *
4
+ * Usage:
5
+ * let expr [expr ...]
6
+ * let "x=1" "y=x+2"
7
+ *
8
+ * Each argument is evaluated as an arithmetic expression.
9
+ * Returns 0 if the last expression evaluates to non-zero,
10
+ * returns 1 if it evaluates to zero.
11
+ *
12
+ * Note: In bash, `let x=( 1 )` passes separate args ["x=(", "1", ")"]
13
+ * when not quoted. The let builtin needs to handle this by joining
14
+ * arguments that are part of the same expression.
15
+ */
16
+ import type { ExecResult } from "../../types.js";
17
+ import type { InterpreterContext } from "../types.js";
18
+ export declare function handleLet(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * local - Declare local variables in functions builtin
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ export declare function handleLocal(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * read - Read a line of input builtin
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ export declare function handleRead(ctx: InterpreterContext, args: string[], stdin: string): ExecResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * return - Return from a function with an exit code
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ export declare function handleReturn(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * set - Set/unset shell options builtin
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ export declare function handleSet(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * shift - Shift positional parameters
3
+ *
4
+ * shift [n]
5
+ *
6
+ * Shifts positional parameters to the left by n (default 1).
7
+ * $n+1 becomes $1, $n+2 becomes $2, etc.
8
+ * $# is decremented by n.
9
+ */
10
+ import type { ExecResult } from "../../types.js";
11
+ import type { InterpreterContext } from "../types.js";
12
+ export declare function handleShift(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * source/. - Execute commands from a file in current environment builtin
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ export declare function handleSource(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * unset - Remove variables/functions builtin
3
+ *
4
+ * Supports:
5
+ * - unset VAR - remove variable
6
+ * - unset -v VAR - remove variable (explicit)
7
+ * - unset -f FUNC - remove function
8
+ * - unset 'a[i]' - remove array element (with arithmetic index support)
9
+ */
10
+ import type { ExecResult } from "../../types.js";
11
+ import type { InterpreterContext } from "../types.js";
12
+ export declare function handleUnset(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Variable assignment helpers for declare, readonly, local, export builtins.
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ import type { InterpreterContext } from "../types.js";
6
+ /**
7
+ * Result of parsing an assignment argument.
8
+ */
9
+ export interface ParsedAssignment {
10
+ name: string;
11
+ isArray: boolean;
12
+ arrayElements?: string[];
13
+ value?: string;
14
+ }
15
+ /**
16
+ * Parse an assignment argument like "name=value" or "name=(a b c)".
17
+ */
18
+ export declare function parseAssignment(arg: string): ParsedAssignment;
19
+ /**
20
+ * Options for setting a variable.
21
+ */
22
+ export interface SetVariableOptions {
23
+ makeReadonly?: boolean;
24
+ checkReadonly?: boolean;
25
+ }
26
+ /**
27
+ * Set a variable from a parsed assignment.
28
+ * Returns an error result if the variable is readonly, otherwise null.
29
+ */
30
+ export declare function setVariable(ctx: InterpreterContext, assignment: ParsedAssignment, options?: SetVariableOptions): ExecResult | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Conditional Expression Evaluation
3
+ *
4
+ * Handles:
5
+ * - [[ ... ]] conditional commands
6
+ * - [ ... ] and test commands
7
+ * - File tests (-f, -d, -e, etc.)
8
+ * - String tests (-z, -n, =, !=)
9
+ * - Numeric comparisons (-eq, -ne, -lt, etc.)
10
+ * - Pattern matching (==, =~)
11
+ */
12
+ import type { ConditionalExpressionNode } from "../ast/types.js";
13
+ import type { ExecResult } from "../types.js";
14
+ import type { InterpreterContext } from "./types.js";
15
+ export declare function evaluateConditional(ctx: InterpreterContext, expr: ConditionalExpressionNode): Promise<boolean>;
16
+ export declare function evaluateTestArgs(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
17
+ export declare function matchPattern(value: string, pattern: string): boolean;