just-bash 2.5.5 → 2.6.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 (281) hide show
  1. package/README.md +2 -2
  2. package/dist/AGENTS.md +2 -2
  3. package/dist/ast/types.d.ts +100 -11
  4. package/dist/bin/chunks/alias-EGIS5LUE.js +7 -0
  5. package/dist/bin/chunks/awk2-GFEJOWML.js +21 -0
  6. package/dist/bin/chunks/bash-PGDTHIM2.js +6 -0
  7. package/dist/bin/chunks/chmod-TYLTHXFR.js +9 -0
  8. package/dist/bin/chunks/chunk-D5WP4CKS.js +3 -0
  9. package/dist/bin/chunks/chunk-FSAGDARS.js +74 -0
  10. package/dist/bin/chunks/chunk-FSZWFMB4.js +16 -0
  11. package/dist/bin/chunks/chunk-IRUD2E3M.js +17 -0
  12. package/dist/bin/chunks/chunk-K5IXNHO5.js +8 -0
  13. package/dist/bin/chunks/chunk-KD3EODLB.js +6 -0
  14. package/dist/bin/{shell/chunks/echo-WSKTON6U.js → chunks/echo-7I42V66Q.js} +2 -2
  15. package/dist/bin/chunks/env-7A4MH7BJ.js +9 -0
  16. package/dist/bin/chunks/expansion-BOR3ELLC.js +2 -0
  17. package/dist/bin/{shell/chunks/find-CBEJ35BR.js → chunks/find-PHDZK64M.js} +1 -1
  18. package/dist/bin/{shell/chunks/grep-IIVQXFNI.js → chunks/grep-VX7MJMVN.js} +2 -2
  19. package/dist/bin/chunks/{head-DYK37Z24.js → head-TJHLLIMR.js} +1 -1
  20. package/dist/bin/{shell/chunks/jq-XXZPU5CA.js → chunks/jq-RGZHJNXC.js} +1 -1
  21. package/dist/bin/chunks/od-KRKGC2U3.js +5 -0
  22. package/dist/bin/chunks/printf-YPXD4CRE.js +15 -0
  23. package/dist/bin/chunks/pwd-L26WH2K4.js +3 -0
  24. package/dist/bin/{shell/chunks/rg-Q4OTJOEF.js → chunks/rg-RSDLLECO.js} +1 -1
  25. package/dist/bin/chunks/rmdir-GOODLY5W.js +14 -0
  26. package/dist/bin/chunks/sed-JPDTWF4W.js +100 -0
  27. package/dist/bin/{shell/chunks/tail-BES27CZT.js → chunks/tail-YAUIERGN.js} +1 -1
  28. package/dist/bin/{shell/chunks/tar-C27YYUAS.js → chunks/tar-LFENC54A.js} +7 -7
  29. package/dist/bin/chunks/time-37F5EBPK.js +14 -0
  30. package/dist/bin/chunks/touch-IBPHJBM3.js +7 -0
  31. package/dist/bin/chunks/wc-SAOHEZYP.js +6 -0
  32. package/dist/bin/chunks/{which-73KOOLC6.js → which-FCDFBOMN.js} +1 -1
  33. package/dist/bin/chunks/whoami-JVLUNKSG.js +3 -0
  34. package/dist/bin/{shell/chunks/xan-6K2NGTHM.js → chunks/xan-5HNHTFMB.js} +19 -19
  35. package/dist/bin/chunks/{yq-MF2SNFGL.js → yq-PFV4T2PV.js} +1 -1
  36. package/dist/bin/just-bash.js +659 -135
  37. package/dist/bin/shell/chunks/alias-EGIS5LUE.js +7 -0
  38. package/dist/bin/shell/chunks/awk2-GFEJOWML.js +21 -0
  39. package/dist/bin/shell/chunks/bash-PGDTHIM2.js +6 -0
  40. package/dist/bin/shell/chunks/chmod-TYLTHXFR.js +9 -0
  41. package/dist/bin/shell/chunks/chunk-D5WP4CKS.js +3 -0
  42. package/dist/bin/shell/chunks/chunk-FSAGDARS.js +74 -0
  43. package/dist/bin/shell/chunks/chunk-FSZWFMB4.js +16 -0
  44. package/dist/bin/shell/chunks/chunk-IRUD2E3M.js +17 -0
  45. package/dist/bin/shell/chunks/chunk-K5IXNHO5.js +8 -0
  46. package/dist/bin/shell/chunks/chunk-KD3EODLB.js +6 -0
  47. package/dist/bin/{chunks/echo-WSKTON6U.js → shell/chunks/echo-7I42V66Q.js} +2 -2
  48. package/dist/bin/shell/chunks/env-7A4MH7BJ.js +9 -0
  49. package/dist/bin/shell/chunks/expansion-BOR3ELLC.js +2 -0
  50. package/dist/bin/{chunks/find-CBEJ35BR.js → shell/chunks/find-PHDZK64M.js} +1 -1
  51. package/dist/bin/{chunks/grep-IIVQXFNI.js → shell/chunks/grep-VX7MJMVN.js} +2 -2
  52. package/dist/bin/shell/chunks/{head-DYK37Z24.js → head-TJHLLIMR.js} +1 -1
  53. package/dist/bin/{chunks/jq-XXZPU5CA.js → shell/chunks/jq-RGZHJNXC.js} +1 -1
  54. package/dist/bin/shell/chunks/od-KRKGC2U3.js +5 -0
  55. package/dist/bin/shell/chunks/printf-YPXD4CRE.js +15 -0
  56. package/dist/bin/shell/chunks/pwd-L26WH2K4.js +3 -0
  57. package/dist/bin/{chunks/rg-Q4OTJOEF.js → shell/chunks/rg-RSDLLECO.js} +1 -1
  58. package/dist/bin/shell/chunks/rmdir-GOODLY5W.js +14 -0
  59. package/dist/bin/shell/chunks/sed-JPDTWF4W.js +100 -0
  60. package/dist/bin/{chunks/tail-BES27CZT.js → shell/chunks/tail-YAUIERGN.js} +1 -1
  61. package/dist/bin/{chunks/tar-C27YYUAS.js → shell/chunks/tar-LFENC54A.js} +7 -7
  62. package/dist/bin/shell/chunks/time-37F5EBPK.js +14 -0
  63. package/dist/bin/shell/chunks/touch-IBPHJBM3.js +7 -0
  64. package/dist/bin/shell/chunks/wc-SAOHEZYP.js +6 -0
  65. package/dist/bin/shell/chunks/{which-73KOOLC6.js → which-FCDFBOMN.js} +1 -1
  66. package/dist/bin/shell/chunks/whoami-JVLUNKSG.js +3 -0
  67. package/dist/bin/{chunks/xan-6K2NGTHM.js → shell/chunks/xan-5HNHTFMB.js} +19 -19
  68. package/dist/bin/shell/chunks/{yq-MF2SNFGL.js → yq-PFV4T2PV.js} +1 -1
  69. package/dist/bin/shell/shell.js +664 -140
  70. package/dist/bundle/browser.js +1251 -606
  71. package/dist/bundle/chunks/alias-ATFBB6D2.js +6 -0
  72. package/dist/bundle/chunks/awk2-6FBZTP57.js +20 -0
  73. package/dist/bundle/chunks/bash-OLRNM52U.js +5 -0
  74. package/dist/bundle/chunks/chmod-ODWUR7E6.js +8 -0
  75. package/dist/bundle/chunks/chunk-3AWP5CWK.js +73 -0
  76. package/dist/bundle/chunks/chunk-CXEWLFNE.js +16 -0
  77. package/dist/bundle/chunks/chunk-CZPA5RBA.js +5 -0
  78. package/dist/bundle/chunks/chunk-EEXR5ZDP.js +2 -0
  79. package/dist/bundle/chunks/chunk-HDQ56CKY.js +15 -0
  80. package/dist/bundle/chunks/chunk-PSW6BMXW.js +7 -0
  81. package/dist/bundle/chunks/{echo-VUHWYV6L.js → echo-6S7WE7XB.js} +2 -2
  82. package/dist/bundle/chunks/env-2UI6XINU.js +8 -0
  83. package/dist/bundle/chunks/expansion-RIGCFEMA.js +1 -0
  84. package/dist/bundle/chunks/{find-ACOAWALE.js → find-YGMSVGUV.js} +1 -1
  85. package/dist/bundle/chunks/{grep-ACVE42JK.js → grep-NIC6JNLH.js} +2 -2
  86. package/dist/bundle/chunks/{head-FZ6IQHYW.js → head-SA7P5NJ7.js} +1 -1
  87. package/dist/bundle/chunks/{jq-3YU5HRKE.js → jq-RLRYRPOJ.js} +1 -1
  88. package/dist/bundle/chunks/od-3FPDPLWJ.js +4 -0
  89. package/dist/bundle/chunks/printf-66XGXFCD.js +14 -0
  90. package/dist/bundle/chunks/pwd-S4NVAMC4.js +2 -0
  91. package/dist/bundle/chunks/{rg-YLZJWCEJ.js → rg-SRMB7L6G.js} +1 -1
  92. package/dist/bundle/chunks/rmdir-XFQE4ZYV.js +13 -0
  93. package/dist/bundle/chunks/sed-IV6HLDXU.js +99 -0
  94. package/dist/bundle/chunks/{tail-PD4RZR6J.js → tail-52LRAWXT.js} +1 -1
  95. package/dist/bundle/chunks/{tar-QWBXMF7K.js → tar-LWIHPMT6.js} +7 -7
  96. package/dist/bundle/chunks/time-UWXBG6CS.js +13 -0
  97. package/dist/bundle/chunks/touch-TDTEBHHI.js +6 -0
  98. package/dist/bundle/chunks/wc-HE5XARI4.js +5 -0
  99. package/dist/bundle/chunks/{which-M5MQ6QXQ.js → which-UBLRBDHN.js} +1 -1
  100. package/dist/bundle/chunks/whoami-YUDAIS32.js +2 -0
  101. package/dist/bundle/chunks/{xan-2R2APJJ4.js → xan-A6VPI4HJ.js} +19 -19
  102. package/dist/bundle/chunks/{yq-KANM4MD2.js → yq-L665QPQU.js} +1 -1
  103. package/dist/bundle/index.js +657 -133
  104. package/dist/commands/awk/ast.d.ts +1 -0
  105. package/dist/commands/awk/interpreter/context.d.ts +14 -0
  106. package/dist/commands/awk/interpreter/interpreter.d.ts +2 -0
  107. package/dist/commands/awk/interpreter/{helpers.d.ts → type-coercion.d.ts} +4 -1
  108. package/dist/commands/awk/parser2-print.d.ts +35 -0
  109. package/dist/commands/awk/parser2.d.ts +42 -34
  110. package/dist/commands/printf/strftime.d.ts +9 -0
  111. package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
  112. package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
  113. package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
  114. package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
  115. package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
  116. package/dist/commands/query-engine/builtins/index.d.ts +17 -0
  117. package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
  118. package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
  119. package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
  120. package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
  121. package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
  122. package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
  123. package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
  124. package/dist/commands/query-engine/evaluator.d.ts +10 -2
  125. package/dist/commands/query-engine/parser-types.d.ts +171 -0
  126. package/dist/commands/query-engine/parser.d.ts +2 -132
  127. package/dist/commands/query-engine/path-operations.d.ts +15 -0
  128. package/dist/commands/query-engine/value-operations.d.ts +39 -0
  129. package/dist/commands/registry.d.ts +1 -1
  130. package/dist/commands/rmdir/rmdir.d.ts +2 -0
  131. package/dist/commands/sed/lexer.d.ts +12 -0
  132. package/dist/commands/sed/parser.d.ts +9 -0
  133. package/dist/commands/sed/sed-regex.d.ts +23 -0
  134. package/dist/commands/sed/types.d.ts +13 -1
  135. package/dist/commands/tar/tar-options.d.ts +36 -0
  136. package/dist/commands/time/time.d.ts +25 -0
  137. package/dist/commands/whoami/whoami.d.ts +9 -0
  138. package/dist/commands/xan/moonblade-tokenizer.d.ts +25 -0
  139. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +12 -0
  140. package/dist/fs/interface.d.ts +16 -0
  141. package/dist/fs/mountable-fs/mountable-fs.d.ts +12 -0
  142. package/dist/fs/overlay-fs/overlay-fs.d.ts +13 -1
  143. package/dist/fs/read-write-fs/read-write-fs.d.ts +13 -1
  144. package/dist/interpreter/alias-expansion.d.ts +23 -0
  145. package/dist/interpreter/arithmetic.d.ts +1 -6
  146. package/dist/interpreter/assignment-expansion.d.ts +24 -0
  147. package/dist/interpreter/builtin-dispatch.d.ts +39 -0
  148. package/dist/interpreter/builtins/compgen.d.ts +26 -0
  149. package/dist/interpreter/builtins/complete.d.ts +17 -0
  150. package/dist/interpreter/builtins/compopt.d.ts +28 -0
  151. package/dist/interpreter/builtins/declare-array-parsing.d.ts +14 -0
  152. package/dist/interpreter/builtins/declare-print.d.ts +39 -0
  153. package/dist/interpreter/builtins/declare.d.ts +10 -4
  154. package/dist/interpreter/builtins/dirs.d.ts +29 -0
  155. package/dist/interpreter/builtins/eval.d.ts +1 -1
  156. package/dist/interpreter/builtins/export.d.ts +1 -0
  157. package/dist/interpreter/builtins/getopts.d.ts +18 -0
  158. package/dist/interpreter/builtins/hash.d.ts +19 -0
  159. package/dist/interpreter/builtins/help.d.ts +12 -0
  160. package/dist/interpreter/builtins/index.d.ts +9 -1
  161. package/dist/interpreter/builtins/local.d.ts +1 -1
  162. package/dist/interpreter/builtins/read.d.ts +1 -1
  163. package/dist/interpreter/builtins/set.d.ts +3 -0
  164. package/dist/interpreter/builtins/shift.d.ts +3 -0
  165. package/dist/interpreter/builtins/shopt.d.ts +7 -0
  166. package/dist/interpreter/builtins/unset.d.ts +5 -1
  167. package/dist/interpreter/builtins/variable-assignment.d.ts +66 -0
  168. package/dist/interpreter/command-resolution.d.ts +43 -0
  169. package/dist/interpreter/conditionals.d.ts +1 -1
  170. package/dist/interpreter/errors.d.ts +36 -1
  171. package/dist/interpreter/expansion/analysis.d.ts +15 -17
  172. package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
  173. package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
  174. package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
  175. package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
  176. package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
  177. package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
  178. package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
  179. package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
  180. package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
  181. package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
  182. package/dist/interpreter/expansion/pattern-removal.d.ts +18 -0
  183. package/dist/interpreter/expansion/pattern.d.ts +2 -1
  184. package/dist/interpreter/expansion/positional-params.d.ts +59 -0
  185. package/dist/interpreter/expansion/prompt.d.ts +39 -0
  186. package/dist/interpreter/expansion/quoting.d.ts +13 -0
  187. package/dist/interpreter/expansion/tilde.d.ts +12 -0
  188. package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
  189. package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
  190. package/dist/interpreter/expansion/variable.d.ts +10 -1
  191. package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
  192. package/dist/interpreter/expansion/word-split.d.ts +11 -6
  193. package/dist/interpreter/expansion.d.ts +30 -4
  194. package/dist/interpreter/functions.d.ts +1 -1
  195. package/dist/interpreter/helpers/array.d.ts +20 -0
  196. package/dist/interpreter/helpers/ifs.d.ts +66 -5
  197. package/dist/interpreter/helpers/nameref.d.ts +65 -0
  198. package/dist/interpreter/helpers/quoting.d.ts +24 -0
  199. package/dist/interpreter/helpers/readonly.d.ts +28 -4
  200. package/dist/interpreter/helpers/shell-constants.d.ts +25 -0
  201. package/dist/interpreter/helpers/shellopts.d.ts +28 -0
  202. package/dist/interpreter/helpers/string-compare.d.ts +3 -1
  203. package/dist/interpreter/helpers/tilde.d.ts +13 -0
  204. package/dist/interpreter/helpers/variable-tests.d.ts +1 -1
  205. package/dist/interpreter/helpers/word-matching.d.ts +26 -0
  206. package/dist/interpreter/helpers/xtrace.d.ts +18 -0
  207. package/dist/interpreter/interpreter.d.ts +13 -14
  208. package/dist/interpreter/pipeline-execution.d.ts +16 -0
  209. package/dist/interpreter/redirections.d.ts +38 -1
  210. package/dist/interpreter/simple-command-assignments.d.ts +29 -0
  211. package/dist/interpreter/subshell-group.d.ts +32 -0
  212. package/dist/interpreter/type-command.d.ts +37 -0
  213. package/dist/interpreter/types.d.ts +255 -21
  214. package/dist/parser/arithmetic-parser.d.ts +2 -4
  215. package/dist/parser/arithmetic-primaries.d.ts +45 -0
  216. package/dist/parser/compound-parser.d.ts +21 -7
  217. package/dist/parser/expansion-parser.d.ts +7 -1
  218. package/dist/parser/lexer.d.ts +57 -0
  219. package/dist/parser/parser-substitution.d.ts +62 -0
  220. package/dist/parser/parser.d.ts +39 -2
  221. package/dist/parser/types.d.ts +1 -0
  222. package/dist/types.d.ts +17 -0
  223. package/package.json +4 -1
  224. package/dist/bin/chunks/alias-PCMLRCRW.js +0 -7
  225. package/dist/bin/chunks/awk2-D2US2LMM.js +0 -20
  226. package/dist/bin/chunks/bash-UT3MT5UU.js +0 -7
  227. package/dist/bin/chunks/chmod-3DIKREF7.js +0 -9
  228. package/dist/bin/chunks/chunk-ACRTDIBO.js +0 -6
  229. package/dist/bin/chunks/chunk-DV5HL4K2.js +0 -17
  230. package/dist/bin/chunks/chunk-J7BCMQDI.js +0 -16
  231. package/dist/bin/chunks/chunk-NWWB2XRE.js +0 -6
  232. package/dist/bin/chunks/chunk-PM2DS2YW.js +0 -3
  233. package/dist/bin/chunks/env-YLLSNZZN.js +0 -9
  234. package/dist/bin/chunks/od-SLM7SRWU.js +0 -7
  235. package/dist/bin/chunks/printf-HWUQKYUM.js +0 -14
  236. package/dist/bin/chunks/pwd-53KG2MCJ.js +0 -3
  237. package/dist/bin/chunks/sed-5LQMJYRJ.js +0 -80
  238. package/dist/bin/chunks/touch-TSNAXMZ2.js +0 -4
  239. package/dist/bin/chunks/wc-QSBRKIF5.js +0 -6
  240. package/dist/bin/shell/chunks/alias-PCMLRCRW.js +0 -7
  241. package/dist/bin/shell/chunks/awk2-D2US2LMM.js +0 -20
  242. package/dist/bin/shell/chunks/bash-UT3MT5UU.js +0 -7
  243. package/dist/bin/shell/chunks/chmod-3DIKREF7.js +0 -9
  244. package/dist/bin/shell/chunks/chunk-ACRTDIBO.js +0 -6
  245. package/dist/bin/shell/chunks/chunk-DV5HL4K2.js +0 -17
  246. package/dist/bin/shell/chunks/chunk-J7BCMQDI.js +0 -16
  247. package/dist/bin/shell/chunks/chunk-NWWB2XRE.js +0 -6
  248. package/dist/bin/shell/chunks/chunk-PM2DS2YW.js +0 -3
  249. package/dist/bin/shell/chunks/env-YLLSNZZN.js +0 -9
  250. package/dist/bin/shell/chunks/od-SLM7SRWU.js +0 -7
  251. package/dist/bin/shell/chunks/printf-HWUQKYUM.js +0 -14
  252. package/dist/bin/shell/chunks/pwd-53KG2MCJ.js +0 -3
  253. package/dist/bin/shell/chunks/sed-5LQMJYRJ.js +0 -80
  254. package/dist/bin/shell/chunks/touch-TSNAXMZ2.js +0 -4
  255. package/dist/bin/shell/chunks/wc-QSBRKIF5.js +0 -6
  256. package/dist/bundle/chunks/alias-4UGRF4DM.js +0 -6
  257. package/dist/bundle/chunks/awk2-46RTIZKB.js +0 -19
  258. package/dist/bundle/chunks/bash-ZILV3VHA.js +0 -6
  259. package/dist/bundle/chunks/chmod-FBHLEIY6.js +0 -8
  260. package/dist/bundle/chunks/chunk-4JO5BKO4.js +0 -5
  261. package/dist/bundle/chunks/chunk-BOJ3OAZB.js +0 -16
  262. package/dist/bundle/chunks/chunk-CG2HXOFG.js +0 -5
  263. package/dist/bundle/chunks/chunk-NWEGHOXL.js +0 -2
  264. package/dist/bundle/chunks/chunk-W2EKKAIL.js +0 -15
  265. package/dist/bundle/chunks/env-EG5SQSAQ.js +0 -8
  266. package/dist/bundle/chunks/od-ECWXNUB4.js +0 -6
  267. package/dist/bundle/chunks/printf-VG2POOXB.js +0 -13
  268. package/dist/bundle/chunks/pwd-AC4P3JKI.js +0 -2
  269. package/dist/bundle/chunks/sed-ZKODWZ6F.js +0 -79
  270. package/dist/bundle/chunks/touch-MVQSKQKT.js +0 -3
  271. package/dist/bundle/chunks/wc-DFQKWSIZ.js +0 -5
  272. package/dist/interpreter/builtins/variable-helpers.d.ts +0 -30
  273. /package/dist/bin/chunks/{curl-LCMREE7R.js → curl-TH7YRBSA.js} +0 -0
  274. /package/dist/bin/chunks/{file-LNCFDPQZ.js → file-6PCTL3MH.js} +0 -0
  275. /package/dist/bin/shell/chunks/{curl-LCMREE7R.js → curl-TH7YRBSA.js} +0 -0
  276. /package/dist/bin/shell/chunks/{file-LNCFDPQZ.js → file-6PCTL3MH.js} +0 -0
  277. /package/dist/bundle/chunks/{curl-TVZH24MD.js → curl-XLP4VABU.js} +0 -0
  278. /package/dist/bundle/chunks/{file-XPA6O6H2.js → file-NQP3CKRV.js} +0 -0
  279. /package/dist/commands/curl/{utils.d.ts → response-formatting.d.ts} +0 -0
  280. /package/dist/commands/xan/{xan-utils.d.ts → column-selection.d.ts} +0 -0
  281. /package/dist/fs/{utils.d.ts → encoding.d.ts} +0 -0
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Builtin Command Dispatch
3
+ *
4
+ * Handles dispatch of built-in shell commands like export, unset, cd, etc.
5
+ * Separated from interpreter.ts for modularity.
6
+ */
7
+ import type { ExecResult } from "../types.js";
8
+ import type { InterpreterContext } from "./types.js";
9
+ /**
10
+ * Type for the function that runs a command recursively
11
+ */
12
+ export type RunCommandFn = (commandName: string, args: string[], quotedArgs: boolean[], stdin: string, skipFunctions?: boolean, useDefaultPath?: boolean, stdinSourceFd?: number) => Promise<ExecResult>;
13
+ /**
14
+ * Type for the function that builds exported environment
15
+ */
16
+ export type BuildExportedEnvFn = () => Record<string, string>;
17
+ /**
18
+ * Type for the function that executes user scripts
19
+ */
20
+ export type ExecuteUserScriptFn = (scriptPath: string, args: string[], stdin?: string) => Promise<ExecResult>;
21
+ /**
22
+ * Dispatch context containing dependencies needed for builtin dispatch
23
+ */
24
+ export interface BuiltinDispatchContext {
25
+ ctx: InterpreterContext;
26
+ runCommand: RunCommandFn;
27
+ buildExportedEnv: BuildExportedEnvFn;
28
+ executeUserScript: ExecuteUserScriptFn;
29
+ }
30
+ /**
31
+ * Dispatch a command to the appropriate builtin handler or external command.
32
+ * Returns null if the command should be handled by external command resolution.
33
+ */
34
+ export declare function dispatchBuiltin(dispatchCtx: BuiltinDispatchContext, commandName: string, args: string[], _quotedArgs: boolean[], stdin: string, skipFunctions: boolean, _useDefaultPath: boolean, stdinSourceFd: number): Promise<ExecResult | null>;
35
+ /**
36
+ * Handle external command resolution and execution.
37
+ * Called when dispatchBuiltin returns null.
38
+ */
39
+ export declare function executeExternalCommand(dispatchCtx: BuiltinDispatchContext, commandName: string, args: string[], stdin: string, useDefaultPath: boolean): Promise<ExecResult>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * compgen - Generate completion matches
3
+ *
4
+ * Usage:
5
+ * compgen -v [prefix] - List variable names (optionally starting with prefix)
6
+ * compgen -A variable [prefix] - Same as -v
7
+ * compgen -A function [prefix] - List function names
8
+ * compgen -e [prefix] - List exported variable names
9
+ * compgen -A builtin [prefix] - List builtin command names
10
+ * compgen -A keyword [prefix] - List shell keywords (alias: -k)
11
+ * compgen -A alias [prefix] - List alias names
12
+ * compgen -A shopt [prefix] - List shopt options
13
+ * compgen -A helptopic [prefix] - List help topics
14
+ * compgen -A directory [prefix] - List directory names
15
+ * compgen -A file [prefix] - List file names
16
+ * compgen -f [prefix] - List file names (alias for -A file)
17
+ * compgen -A user - List user names
18
+ * compgen -A command [prefix] - List commands (builtins, functions, aliases, external)
19
+ * compgen -W wordlist [prefix] - Generate from wordlist
20
+ * compgen -P prefix - Prefix to add to completions
21
+ * compgen -S suffix - Suffix to add to completions
22
+ * compgen -o option - Completion option (plusdirs, dirnames, default, etc.)
23
+ */
24
+ import type { ExecResult } from "../../types.js";
25
+ import type { InterpreterContext } from "../types.js";
26
+ export declare function handleCompgen(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * complete - Set and display programmable completion specifications
3
+ *
4
+ * Usage:
5
+ * complete - List all completion specs
6
+ * complete -p - Print all completion specs in reusable format
7
+ * complete -p cmd - Print completion spec for specific command
8
+ * complete -W 'word1 word2' cmd - Set word list completion for cmd
9
+ * complete -F func cmd - Set function completion for cmd
10
+ * complete -r cmd - Remove completion spec for cmd
11
+ * complete -r - Remove all completion specs
12
+ * complete -D ... - Set default completion (for commands with no specific spec)
13
+ * complete -o opt cmd - Set completion options (nospace, filenames, default, etc.)
14
+ */
15
+ import type { ExecResult } from "../../types.js";
16
+ import type { InterpreterContext } from "../types.js";
17
+ export declare function handleComplete(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * compopt - Modify completion options
3
+ *
4
+ * Usage:
5
+ * compopt [-o option] [+o option] [name ...]
6
+ * compopt -D [-o option] [+o option]
7
+ * compopt -E [-o option] [+o option]
8
+ *
9
+ * Modifies completion options for the specified commands (names) or the
10
+ * currently executing completion when no names are provided.
11
+ *
12
+ * Options:
13
+ * -o option Enable completion option
14
+ * +o option Disable completion option
15
+ * -D Apply to default completion
16
+ * -E Apply to empty-line completion
17
+ *
18
+ * Valid completion options:
19
+ * bashdefault, default, dirnames, filenames, noquote, nosort, nospace, plusdirs
20
+ *
21
+ * Returns:
22
+ * 0 on success
23
+ * 1 if not in a completion function and no command name is given
24
+ * 2 if an invalid option is specified
25
+ */
26
+ import type { ExecResult } from "../../types.js";
27
+ import type { InterpreterContext } from "../types.js";
28
+ export declare function handleCompopt(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Array Parsing Functions for declare/typeset
3
+ *
4
+ * Handles parsing of array literal syntax for the declare builtin.
5
+ */
6
+ /**
7
+ * Parse array elements from content like "1 2 3" or "'a b' c d"
8
+ */
9
+ export declare function parseArrayElements(content: string): string[];
10
+ /**
11
+ * Parse associative array literal content like "['foo']=bar ['spam']=42"
12
+ * Returns array of [key, value] pairs
13
+ */
14
+ export declare function parseAssocArrayLiteral(content: string): [string, string][];
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Declare Print Mode Functions
3
+ *
4
+ * Handles printing and listing variables for the declare/typeset builtin.
5
+ */
6
+ import type { ExecResult } from "../../types.js";
7
+ import type { InterpreterContext } from "../types.js";
8
+ /**
9
+ * Print specific variables with their declarations.
10
+ * Handles: declare -p varname1 varname2 ...
11
+ */
12
+ export declare function printSpecificVariables(ctx: InterpreterContext, names: string[]): ExecResult;
13
+ export interface PrintAllFilters {
14
+ filterExport: boolean;
15
+ filterReadonly: boolean;
16
+ filterNameref: boolean;
17
+ filterIndexedArray: boolean;
18
+ filterAssocArray: boolean;
19
+ }
20
+ /**
21
+ * Print all variables with their declarations and attributes.
22
+ * Handles: declare -p (with optional filters like -x, -r, -n, -a, -A)
23
+ */
24
+ export declare function printAllVariables(ctx: InterpreterContext, filters: PrintAllFilters): ExecResult;
25
+ /**
26
+ * List all associative arrays.
27
+ * Handles: declare -A (without arguments)
28
+ */
29
+ export declare function listAssociativeArrays(ctx: InterpreterContext): ExecResult;
30
+ /**
31
+ * List all indexed arrays.
32
+ * Handles: declare -a (without arguments)
33
+ */
34
+ export declare function listIndexedArrays(ctx: InterpreterContext): ExecResult;
35
+ /**
36
+ * List all variables without print mode (no attributes shown).
37
+ * Handles: declare (without -p and without arguments)
38
+ */
39
+ export declare function listAllVariables(ctx: InterpreterContext): ExecResult;
@@ -9,16 +9,22 @@
9
9
  * declare -A NAME - Declare associative array
10
10
  * declare -r NAME - Declare readonly variable
11
11
  * declare -x NAME - Export variable
12
+ * declare -g NAME - Declare global variable (inside functions)
12
13
  *
13
14
  * Also aliased as 'typeset'
14
15
  */
15
16
  import type { ExecResult } from "../../types.js";
16
17
  import type { InterpreterContext } from "../types.js";
17
- export declare function handleDeclare(ctx: InterpreterContext, args: string[]): ExecResult;
18
18
  /**
19
- * Parse array elements from content like "1 2 3" or "'a b' c d"
19
+ * Check if a variable has the integer attribute.
20
20
  */
21
- export declare function parseArrayElements(content: string): string[];
21
+ export declare function isInteger(ctx: InterpreterContext, name: string): boolean;
22
+ /**
23
+ * Apply case transformation based on variable attributes.
24
+ * Returns the transformed value.
25
+ */
26
+ export declare function applyCaseTransform(ctx: InterpreterContext, name: string, value: string): string;
27
+ export declare function handleDeclare(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
22
28
  /**
23
29
  * readonly - Declare readonly variables
24
30
  *
@@ -26,4 +32,4 @@ export declare function parseArrayElements(content: string): string[];
26
32
  * readonly NAME=value - Declare readonly variable
27
33
  * readonly NAME - Mark existing variable as readonly
28
34
  */
29
- export declare function handleReadonly(ctx: InterpreterContext, args: string[]): ExecResult;
35
+ export declare function handleReadonly(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Directory Stack Builtins: pushd, popd, dirs
3
+ *
4
+ * pushd [dir] - Push directory onto stack and cd to it
5
+ * popd - Pop directory from stack and cd to previous
6
+ * dirs [-clpv] - Display directory stack
7
+ */
8
+ import type { ExecResult } from "../../types.js";
9
+ import type { InterpreterContext } from "../types.js";
10
+ /**
11
+ * pushd - Push directory onto stack and cd to it
12
+ *
13
+ * pushd [dir] - Push current dir, cd to dir
14
+ */
15
+ export declare function handlePushd(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
16
+ /**
17
+ * popd - Pop directory from stack and cd to it
18
+ */
19
+ export declare function handlePopd(ctx: InterpreterContext, args: string[]): ExecResult;
20
+ /**
21
+ * dirs - Display directory stack
22
+ *
23
+ * dirs [-clpv]
24
+ * -c: Clear the stack
25
+ * -l: Long format (no tilde substitution)
26
+ * -p: One entry per line
27
+ * -v: One entry per line with index numbers
28
+ */
29
+ export declare function handleDirs(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -6,4 +6,4 @@
6
6
  */
7
7
  import type { ExecResult } from "../../types.js";
8
8
  import type { InterpreterContext } from "../types.js";
9
- export declare function handleEval(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
9
+ export declare function handleEval(ctx: InterpreterContext, args: string[], stdin?: string): Promise<ExecResult>;
@@ -5,6 +5,7 @@
5
5
  * export - List all exported variables
6
6
  * export -p - List all exported variables (same as no args)
7
7
  * export NAME=value - Set and export variable
8
+ * export NAME+=value - Append value and export variable
8
9
  * export NAME - Export existing variable (or create empty)
9
10
  * export -n NAME - Un-export variable (remove from env)
10
11
  */
@@ -0,0 +1,18 @@
1
+ /**
2
+ * getopts - Parse positional parameters as options
3
+ *
4
+ * getopts optstring name [arg...]
5
+ *
6
+ * Parses options from positional parameters (or provided args).
7
+ * - optstring: string of valid option characters
8
+ * - If a character is followed by ':', it requires an argument
9
+ * - If optstring starts with ':', silent error reporting mode
10
+ * - name: variable to store the current option
11
+ * - OPTARG: set to the option argument (if any)
12
+ * - OPTIND: index of next argument to process (starts at 1)
13
+ *
14
+ * Returns 0 if option found, 1 if end of options or error.
15
+ */
16
+ import type { ExecResult } from "../../types.js";
17
+ import type { InterpreterContext } from "../types.js";
18
+ export declare function handleGetopts(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * hash - Manage the hash table of remembered command locations
3
+ *
4
+ * hash [-lr] [-p pathname] [-dt] [name ...]
5
+ *
6
+ * Hash maintains a hash table of recently executed commands for faster lookup.
7
+ *
8
+ * Options:
9
+ * (no args) Display the hash table
10
+ * name Add name to the hash table (look up in PATH)
11
+ * -r Clear the hash table
12
+ * -d name Remove name from the hash table
13
+ * -l Display in a format that can be reused as input
14
+ * -p path Use path as the full pathname for name (hash -p /path name)
15
+ * -t name Print the remembered location of name
16
+ */
17
+ import type { ExecResult } from "../../types.js";
18
+ import type { InterpreterContext } from "../types.js";
19
+ export declare function handleHash(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * help - Display helpful information about builtin commands
3
+ *
4
+ * Usage: help [-s] [pattern ...]
5
+ *
6
+ * If PATTERN is specified, gives detailed help on all commands matching PATTERN,
7
+ * otherwise a list of the builtins is printed. The -s option restricts the output
8
+ * for each builtin command matching PATTERN to a short usage synopsis.
9
+ */
10
+ import type { ExecResult } from "../../types.js";
11
+ import type { InterpreterContext } from "../types.js";
12
+ export declare function handleHelp(_ctx: InterpreterContext, args: string[]): ExecResult;
@@ -21,11 +21,18 @@
21
21
  */
22
22
  export { handleBreak } from "./break.js";
23
23
  export { handleCd } from "./cd.js";
24
+ export { handleCompgen } from "./compgen.js";
25
+ export { handleComplete } from "./complete.js";
26
+ export { handleCompopt } from "./compopt.js";
24
27
  export { handleContinue } from "./continue.js";
25
- export { handleDeclare, handleReadonly } from "./declare.js";
28
+ export { applyCaseTransform, handleDeclare, handleReadonly, isInteger, } from "./declare.js";
29
+ export { handleDirs, handlePopd, handlePushd } from "./dirs.js";
26
30
  export { handleEval } from "./eval.js";
27
31
  export { handleExit } from "./exit.js";
28
32
  export { handleExport } from "./export.js";
33
+ export { handleGetopts } from "./getopts.js";
34
+ export { handleHash } from "./hash.js";
35
+ export { handleHelp } from "./help.js";
29
36
  export { handleLet } from "./let.js";
30
37
  export { handleLocal } from "./local.js";
31
38
  export { handleMapfile } from "./mapfile.js";
@@ -35,3 +42,4 @@ export { handleSet } from "./set.js";
35
42
  export { handleShift } from "./shift.js";
36
43
  export { handleSource } from "./source.js";
37
44
  export { handleUnset } from "./unset.js";
45
+ export { getLocalVarDepth } from "./variable-assignment.js";
@@ -3,4 +3,4 @@
3
3
  */
4
4
  import type { ExecResult } from "../../types.js";
5
5
  import type { InterpreterContext } from "../types.js";
6
- export declare function handleLocal(ctx: InterpreterContext, args: string[]): ExecResult;
6
+ export declare function handleLocal(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -3,4 +3,4 @@
3
3
  */
4
4
  import type { ExecResult } from "../../types.js";
5
5
  import type { InterpreterContext } from "../types.js";
6
- export declare function handleRead(ctx: InterpreterContext, args: string[], stdin: string): ExecResult;
6
+ export declare function handleRead(ctx: InterpreterContext, args: string[], stdin: string, stdinSourceFd?: number): ExecResult;
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * set - Set/unset shell options builtin
3
+ *
4
+ * In POSIX mode (set -o posix), errors from set (like invalid options)
5
+ * cause the script to exit immediately.
3
6
  */
4
7
  import type { ExecResult } from "../../types.js";
5
8
  import type { InterpreterContext } from "../types.js";
@@ -6,6 +6,9 @@
6
6
  * Shifts positional parameters to the left by n (default 1).
7
7
  * $n+1 becomes $1, $n+2 becomes $2, etc.
8
8
  * $# is decremented by n.
9
+ *
10
+ * In POSIX mode (set -o posix), errors from shift (like shift count
11
+ * exceeding available parameters) cause the script to exit immediately.
9
12
  */
10
13
  import type { ExecResult } from "../../types.js";
11
14
  import type { InterpreterContext } from "../types.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * shopt builtin - Shell options
3
+ * Implements bash's shopt builtin for managing shell-specific options
4
+ */
5
+ import type { ExecResult } from "../../types.js";
6
+ import type { InterpreterContext } from "../types.js";
7
+ export declare function handleShopt(ctx: InterpreterContext, args: string[]): ExecResult;
@@ -6,7 +6,11 @@
6
6
  * - unset -v VAR - remove variable (explicit)
7
7
  * - unset -f FUNC - remove function
8
8
  * - unset 'a[i]' - remove array element (with arithmetic index support)
9
+ *
10
+ * Bash-specific unset scoping:
11
+ * - local-unset (same scope): value-unset - clears value but keeps local cell
12
+ * - dynamic-unset (different scope): cell-unset - removes local cell, exposes outer value
9
13
  */
10
14
  import type { ExecResult } from "../../types.js";
11
15
  import type { InterpreterContext } from "../types.js";
12
- export declare function handleUnset(ctx: InterpreterContext, args: string[]): ExecResult;
16
+ export declare function handleUnset(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
@@ -0,0 +1,66 @@
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
+ /** For array index assignment: a[index]=value */
15
+ arrayIndex?: string;
16
+ }
17
+ /**
18
+ * Parse an assignment argument like "name=value", "name=(a b c)", or "name[index]=value".
19
+ */
20
+ export declare function parseAssignment(arg: string): ParsedAssignment;
21
+ /**
22
+ * Options for setting a variable.
23
+ */
24
+ export interface SetVariableOptions {
25
+ makeReadonly?: boolean;
26
+ checkReadonly?: boolean;
27
+ }
28
+ /**
29
+ * Set a variable from a parsed assignment.
30
+ * Returns an error result if the variable is readonly, otherwise null.
31
+ */
32
+ export declare function setVariable(ctx: InterpreterContext, assignment: ParsedAssignment, options?: SetVariableOptions): Promise<ExecResult | null>;
33
+ /**
34
+ * Mark a variable as being declared at the current call depth.
35
+ * Used for bash-specific unset scoping behavior.
36
+ */
37
+ export declare function markLocalVarDepth(ctx: InterpreterContext, name: string): void;
38
+ /**
39
+ * Get the call depth at which a local variable was declared.
40
+ * Returns undefined if the variable is not a local variable.
41
+ */
42
+ export declare function getLocalVarDepth(ctx: InterpreterContext, name: string): number | undefined;
43
+ /**
44
+ * Clear the local variable depth tracking for a variable.
45
+ * Called when a local variable is cell-unset (dynamic-unset).
46
+ */
47
+ export declare function clearLocalVarDepth(ctx: InterpreterContext, name: string): void;
48
+ /**
49
+ * Push the current value of a variable onto the local var stack.
50
+ * Used for bash's localvar-nest behavior where nested local declarations
51
+ * each create a new cell that can be unset independently.
52
+ */
53
+ export declare function pushLocalVarStack(ctx: InterpreterContext, name: string, currentValue: string | undefined): void;
54
+ /**
55
+ * Pop the top entry from the local var stack for a variable.
56
+ * Returns the saved value and scope index if there was an entry, or undefined if the stack was empty.
57
+ */
58
+ export declare function popLocalVarStack(ctx: InterpreterContext, name: string): {
59
+ value: string | undefined;
60
+ scopeIndex: number;
61
+ } | undefined;
62
+ /**
63
+ * Clear all local var stack entries for a specific scope index.
64
+ * Called when a function returns and its local scope is popped.
65
+ */
66
+ export declare function clearLocalVarStackForScope(ctx: InterpreterContext, scopeIndex: number): void;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Command Resolution
3
+ *
4
+ * Handles PATH-based command resolution and lookup for external commands.
5
+ */
6
+ import type { IFileSystem } from "../fs/interface.js";
7
+ import type { Command, CommandRegistry } from "../types.js";
8
+ import type { InterpreterState } from "./types.js";
9
+ /**
10
+ * Context needed for command resolution
11
+ */
12
+ export interface CommandResolutionContext {
13
+ fs: IFileSystem;
14
+ state: InterpreterState;
15
+ commands: CommandRegistry;
16
+ }
17
+ /**
18
+ * Result type for command resolution
19
+ */
20
+ export type ResolveCommandResult = {
21
+ cmd: Command;
22
+ path: string;
23
+ } | {
24
+ script: true;
25
+ path: string;
26
+ } | {
27
+ error: "not_found" | "permission_denied";
28
+ path?: string;
29
+ } | null;
30
+ /**
31
+ * Resolve a command name to its implementation via PATH lookup.
32
+ * Returns the command and its resolved path, or null if not found.
33
+ *
34
+ * Resolution order:
35
+ * 1. If command contains "/", resolve as a path
36
+ * 2. Search PATH directories for the command file
37
+ * 3. Fall back to registry lookup (for non-InMemoryFs filesystems like OverlayFs)
38
+ */
39
+ export declare function resolveCommand(ctx: CommandResolutionContext, commandName: string, pathOverride?: string): Promise<ResolveCommandResult>;
40
+ /**
41
+ * Find all paths for a command in PATH (for `which -a`).
42
+ */
43
+ export declare function findCommandInPath(ctx: CommandResolutionContext, commandName: string): Promise<string[]>;
@@ -14,4 +14,4 @@ import type { ExecResult } from "../types.js";
14
14
  import type { InterpreterContext } from "./types.js";
15
15
  export declare function evaluateConditional(ctx: InterpreterContext, expr: ConditionalExpressionNode): Promise<boolean>;
16
16
  export declare function evaluateTestArgs(ctx: InterpreterContext, args: string[]): Promise<ExecResult>;
17
- export declare function matchPattern(value: string, pattern: string): boolean;
17
+ export declare function matchPattern(value: string, pattern: string, nocasematch?: boolean, extglob?: boolean): boolean;
@@ -78,7 +78,12 @@ export declare class ExitError extends ControlFlowError {
78
78
  */
79
79
  export declare class ArithmeticError extends ControlFlowError {
80
80
  readonly name = "ArithmeticError";
81
- constructor(message: string, stdout?: string, stderr?: string);
81
+ /**
82
+ * If true, this error should abort script execution (like missing operand after binary operator).
83
+ * If false, the error is recoverable and execution can continue.
84
+ */
85
+ fatal: boolean;
86
+ constructor(message: string, stdout?: string, stderr?: string, fatal?: boolean);
82
87
  }
83
88
  /**
84
89
  * Error thrown for bad substitution errors (e.g., ${#var:1:3}).
@@ -88,6 +93,22 @@ export declare class BadSubstitutionError extends ControlFlowError {
88
93
  readonly name = "BadSubstitutionError";
89
94
  constructor(message: string, stdout?: string, stderr?: string);
90
95
  }
96
+ /**
97
+ * Error thrown when failglob is enabled and a glob pattern has no matches.
98
+ * Returns exit code 1.
99
+ */
100
+ export declare class GlobError extends ControlFlowError {
101
+ readonly name = "GlobError";
102
+ constructor(pattern: string, stdout?: string, stderr?: string);
103
+ }
104
+ /**
105
+ * Error thrown for invalid brace expansions (e.g., mixed case character ranges like {z..A}).
106
+ * Returns exit code 1 (matching bash behavior).
107
+ */
108
+ export declare class BraceExpansionError extends ControlFlowError {
109
+ readonly name = "BraceExpansionError";
110
+ constructor(message: string, stdout?: string, stderr?: string);
111
+ }
91
112
  /**
92
113
  * Error thrown when execution limits are exceeded (recursion depth, command count, loop iterations).
93
114
  * This should ALWAYS be thrown before JavaScript's native RangeError kicks in.
@@ -112,4 +133,18 @@ export declare class SubshellExitError extends ControlFlowError {
112
133
  * These need special handling vs errexit/nounset which terminate execution.
113
134
  */
114
135
  export declare function isScopeExitError(error: unknown): error is BreakError | ContinueError | ReturnError;
136
+ /**
137
+ * Error thrown when a POSIX special builtin fails in POSIX mode.
138
+ * In POSIX mode (set -o posix), errors in special builtins like
139
+ * shift, set, readonly, export, etc. cause the entire script to exit.
140
+ *
141
+ * Per POSIX 2.8.1 - Consequences of Shell Errors:
142
+ * "A special built-in utility causes an interactive or non-interactive shell
143
+ * to exit when an error occurs."
144
+ */
145
+ export declare class PosixFatalError extends ControlFlowError {
146
+ readonly exitCode: number;
147
+ readonly name = "PosixFatalError";
148
+ constructor(exitCode: number, stdout?: string, stderr?: string);
149
+ }
115
150
  export {};
@@ -1,28 +1,24 @@
1
1
  /**
2
2
  * Word Analysis
3
3
  *
4
- * Functions for analyzing word parts to determine:
5
- * - Whether async execution is needed
6
- * - What types of expansions are present
4
+ * Functions for analyzing word parts to determine what types of expansions are present.
7
5
  */
8
- import type { ParameterExpansionPart, WordNode, WordPart } from "../../ast/types.js";
6
+ import type { ParameterExpansionPart, WordPart } from "../../ast/types.js";
9
7
  /**
10
- * Check if a parameter expansion requires async execution
8
+ * Check if a glob pattern string contains variable references ($var or ${var})
9
+ * This is used to detect when IFS splitting should apply to expanded glob patterns.
11
10
  */
12
- export declare function paramExpansionNeedsAsync(part: ParameterExpansionPart): boolean;
11
+ export declare function globPatternHasVarRef(pattern: string): boolean;
13
12
  /**
14
- * Check if a word part requires async execution
15
- */
16
- export declare function partNeedsAsync(part: WordPart): boolean;
17
- /**
18
- * Check if a word requires async execution
19
- */
20
- export declare function wordNeedsAsync(word: WordNode): boolean;
21
- /**
22
- * Check if a parameter expansion has quoted parts in its operation word
23
- * e.g., ${v:-"AxBxC"} has a quoted default value
13
+ * Check if a parameter expansion's operation word is entirely quoted (all parts are quoted).
14
+ * This is different from hasQuotedOperationWord which returns true if ANY part is quoted.
15
+ *
16
+ * For word splitting purposes:
17
+ * - ${v:-"AxBxC"} - entirely quoted, should NOT be split
18
+ * - ${v:-x"AxBxC"x} - mixed quoted/unquoted, SHOULD be split (on unquoted parts)
19
+ * - ${v:-AxBxC} - entirely unquoted, SHOULD be split
24
20
  */
25
- export declare function hasQuotedOperationWord(part: ParameterExpansionPart): boolean;
21
+ export declare function isOperationWordEntirelyQuoted(part: ParameterExpansionPart): boolean;
26
22
  /**
27
23
  * Result of analyzing word parts
28
24
  */
@@ -32,6 +28,8 @@ export interface WordPartsAnalysis {
32
28
  hasArrayVar: boolean;
33
29
  hasArrayAtExpansion: boolean;
34
30
  hasParamExpansion: boolean;
31
+ hasVarNamePrefixExpansion: boolean;
32
+ hasIndirection: boolean;
35
33
  }
36
34
  /**
37
35
  * Analyze word parts for expansion behavior
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Arithmetic Text Expansion
3
+ *
4
+ * Functions for expanding variables within arithmetic expression text.
5
+ * This handles the bash behavior where $(( $x * 3 )) with x='1 + 2' should
6
+ * expand to $(( 1 + 2 * 3 )) = 7, not $(( (1+2) * 3 )) = 9.
7
+ */
8
+ import type { InterpreterContext } from "../types.js";
9
+ /**
10
+ * Expand $var patterns in arithmetic expression text for text substitution.
11
+ * Only expands simple $var patterns, not ${...}, $(()), $(), etc.
12
+ */
13
+ export declare function expandDollarVarsInArithText(ctx: InterpreterContext, text: string): Promise<string>;
14
+ /**
15
+ * Expand variable references and command substitutions in an array subscript.
16
+ * e.g., "${array[@]}" -> "1 2 3", "$(echo 1)" -> "1"
17
+ * This is needed for associative array subscripts like assoc["${array[@]}"]
18
+ * where the subscript may contain variable or array expansions.
19
+ */
20
+ export declare function expandSubscriptForAssocArray(ctx: InterpreterContext, subscript: string): Promise<string>;