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
@@ -4,136 +4,6 @@
4
4
  * Tokenizes and parses jq-style filter expressions into an AST.
5
5
  * Used by jq, yq, and other query-based commands.
6
6
  */
7
- export type TokenType = "DOT" | "PIPE" | "COMMA" | "COLON" | "SEMICOLON" | "LPAREN" | "RPAREN" | "LBRACKET" | "RBRACKET" | "LBRACE" | "RBRACE" | "QUESTION" | "PLUS" | "MINUS" | "STAR" | "SLASH" | "PERCENT" | "EQ" | "NE" | "LT" | "LE" | "GT" | "GE" | "AND" | "OR" | "NOT" | "ALT" | "ASSIGN" | "UPDATE_ADD" | "UPDATE_SUB" | "UPDATE_MUL" | "UPDATE_DIV" | "UPDATE_MOD" | "UPDATE_ALT" | "UPDATE_PIPE" | "IDENT" | "NUMBER" | "STRING" | "IF" | "THEN" | "ELIF" | "ELSE" | "END" | "AS" | "TRY" | "CATCH" | "TRUE" | "FALSE" | "NULL" | "REDUCE" | "FOREACH" | "DOTDOT" | "EOF";
8
- export interface Token {
9
- type: TokenType;
10
- value?: string | number;
11
- pos: number;
12
- }
13
- export type AstNode = IdentityNode | FieldNode | IndexNode | SliceNode | IterateNode | PipeNode | CommaNode | LiteralNode | ArrayNode | ObjectNode | ParenNode | BinaryOpNode | UnaryOpNode | CondNode | TryNode | CallNode | VarBindNode | VarRefNode | RecurseNode | OptionalNode | StringInterpNode | UpdateOpNode | ReduceNode | ForeachNode;
14
- export interface IdentityNode {
15
- type: "Identity";
16
- }
17
- export interface FieldNode {
18
- type: "Field";
19
- name: string;
20
- base?: AstNode;
21
- }
22
- export interface IndexNode {
23
- type: "Index";
24
- index: AstNode;
25
- base?: AstNode;
26
- }
27
- export interface SliceNode {
28
- type: "Slice";
29
- start?: AstNode;
30
- end?: AstNode;
31
- base?: AstNode;
32
- }
33
- export interface IterateNode {
34
- type: "Iterate";
35
- base?: AstNode;
36
- }
37
- export interface PipeNode {
38
- type: "Pipe";
39
- left: AstNode;
40
- right: AstNode;
41
- }
42
- export interface CommaNode {
43
- type: "Comma";
44
- left: AstNode;
45
- right: AstNode;
46
- }
47
- export interface LiteralNode {
48
- type: "Literal";
49
- value: unknown;
50
- }
51
- export interface ArrayNode {
52
- type: "Array";
53
- elements?: AstNode;
54
- }
55
- export interface ObjectNode {
56
- type: "Object";
57
- entries: {
58
- key: AstNode | string;
59
- value: AstNode;
60
- }[];
61
- }
62
- export interface ParenNode {
63
- type: "Paren";
64
- expr: AstNode;
65
- }
66
- export interface BinaryOpNode {
67
- type: "BinaryOp";
68
- op: "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | "<=" | ">" | ">=" | "and" | "or" | "//";
69
- left: AstNode;
70
- right: AstNode;
71
- }
72
- export interface UnaryOpNode {
73
- type: "UnaryOp";
74
- op: "-" | "not";
75
- operand: AstNode;
76
- }
77
- export interface CondNode {
78
- type: "Cond";
79
- cond: AstNode;
80
- then: AstNode;
81
- elifs: {
82
- cond: AstNode;
83
- then: AstNode;
84
- }[];
85
- else?: AstNode;
86
- }
87
- export interface TryNode {
88
- type: "Try";
89
- body: AstNode;
90
- catch?: AstNode;
91
- }
92
- export interface CallNode {
93
- type: "Call";
94
- name: string;
95
- args: AstNode[];
96
- }
97
- export interface VarBindNode {
98
- type: "VarBind";
99
- name: string;
100
- value: AstNode;
101
- body: AstNode;
102
- }
103
- export interface VarRefNode {
104
- type: "VarRef";
105
- name: string;
106
- }
107
- export interface RecurseNode {
108
- type: "Recurse";
109
- }
110
- export interface OptionalNode {
111
- type: "Optional";
112
- expr: AstNode;
113
- }
114
- export interface StringInterpNode {
115
- type: "StringInterp";
116
- parts: (string | AstNode)[];
117
- }
118
- export interface UpdateOpNode {
119
- type: "UpdateOp";
120
- op: "+=" | "-=" | "*=" | "/=" | "%=" | "//=" | "=" | "|=";
121
- path: AstNode;
122
- value: AstNode;
123
- }
124
- export interface ReduceNode {
125
- type: "Reduce";
126
- expr: AstNode;
127
- varName: string;
128
- init: AstNode;
129
- update: AstNode;
130
- }
131
- export interface ForeachNode {
132
- type: "Foreach";
133
- expr: AstNode;
134
- varName: string;
135
- init: AstNode;
136
- update: AstNode;
137
- extract?: AstNode;
138
- }
7
+ export type { ArrayNode, AstNode, BinaryOpNode, BreakNode, CallNode, CommaNode, CondNode, DefNode, DestructurePattern, FieldNode, ForeachNode, IdentityNode, IndexNode, IterateNode, LabelNode, LiteralNode, ObjectNode, OptionalNode, ParenNode, PipeNode, RecurseNode, ReduceNode, SliceNode, StringInterpNode, Token, TokenType, TryNode, UnaryOpNode, UpdateOpNode, VarBindNode, VarRefNode, } from "./parser-types.js";
8
+ import type { AstNode } from "./parser-types.js";
139
9
  export declare function parse(input: string): AstNode;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Query Path Utilities
3
+ *
4
+ * Utility functions for path-based operations on query values.
5
+ */
6
+ import type { QueryValue } from "./value-operations.js";
7
+ /**
8
+ * Set a value at a given path within a query value.
9
+ * Creates intermediate arrays/objects as needed.
10
+ */
11
+ export declare function setPath(value: QueryValue, path: (string | number)[], newVal: QueryValue): QueryValue;
12
+ /**
13
+ * Delete a value at a given path within a query value.
14
+ */
15
+ export declare function deletePath(value: QueryValue, path: (string | number)[]): QueryValue;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Query Value Utilities
3
+ *
4
+ * Utility functions for working with jq/query values.
5
+ */
6
+ export type QueryValue = unknown;
7
+ /**
8
+ * Check if a value is truthy in jq semantics.
9
+ * In jq: false and null are falsy, everything else is truthy.
10
+ */
11
+ export declare function isTruthy(v: QueryValue): boolean;
12
+ /**
13
+ * Deep equality check for query values.
14
+ */
15
+ export declare function deepEqual(a: QueryValue, b: QueryValue): boolean;
16
+ /**
17
+ * Compare two values for sorting.
18
+ * Returns negative if a < b, positive if a > b, 0 if equal.
19
+ */
20
+ export declare function compare(a: QueryValue, b: QueryValue): number;
21
+ /**
22
+ * Deep merge two objects.
23
+ * Values from b override values from a, except nested objects are merged recursively.
24
+ */
25
+ export declare function deepMerge(a: Record<string, unknown>, b: Record<string, unknown>): Record<string, unknown>;
26
+ /**
27
+ * Calculate the nesting depth of a value (array or object).
28
+ */
29
+ export declare function getValueDepth(value: QueryValue, maxCheck?: number): number;
30
+ /**
31
+ * Compare two values using jq's comparison semantics.
32
+ * jq sorts by type first (null < bool < number < string < array < object),
33
+ * then by value within type.
34
+ */
35
+ export declare function compareJq(a: QueryValue, b: QueryValue): number;
36
+ /**
37
+ * Check if value a contains value b using jq's containment semantics.
38
+ */
39
+ export declare function containsDeep(a: QueryValue, b: QueryValue): boolean;
@@ -1,6 +1,6 @@
1
1
  import type { Command } from "../types.js";
2
2
  /** All available built-in command names (excludes network commands) */
3
- export type CommandName = "echo" | "cat" | "printf" | "ls" | "mkdir" | "touch" | "rm" | "cp" | "mv" | "ln" | "chmod" | "pwd" | "readlink" | "head" | "tail" | "wc" | "stat" | "grep" | "fgrep" | "egrep" | "rg" | "sed" | "awk" | "sort" | "uniq" | "comm" | "cut" | "paste" | "tr" | "rev" | "nl" | "fold" | "expand" | "unexpand" | "strings" | "split" | "column" | "join" | "tee" | "find" | "basename" | "dirname" | "tree" | "du" | "env" | "printenv" | "alias" | "unalias" | "history" | "xargs" | "true" | "false" | "clear" | "bash" | "sh" | "jq" | "base64" | "diff" | "date" | "sleep" | "timeout" | "seq" | "expr" | "md5sum" | "sha1sum" | "sha256sum" | "file" | "html-to-markdown" | "help" | "which" | "tac" | "hostname" | "od" | "gzip" | "gunzip" | "zcat" | "tar" | "yq" | "xan" | "sqlite3";
3
+ export type CommandName = "echo" | "cat" | "printf" | "ls" | "mkdir" | "rmdir" | "touch" | "rm" | "cp" | "mv" | "ln" | "chmod" | "pwd" | "readlink" | "head" | "tail" | "wc" | "stat" | "grep" | "fgrep" | "egrep" | "rg" | "sed" | "awk" | "sort" | "uniq" | "comm" | "cut" | "paste" | "tr" | "rev" | "nl" | "fold" | "expand" | "unexpand" | "strings" | "split" | "column" | "join" | "tee" | "find" | "basename" | "dirname" | "tree" | "du" | "env" | "printenv" | "alias" | "unalias" | "history" | "xargs" | "true" | "false" | "clear" | "bash" | "sh" | "jq" | "base64" | "diff" | "date" | "sleep" | "timeout" | "seq" | "expr" | "md5sum" | "sha1sum" | "sha256sum" | "file" | "html-to-markdown" | "help" | "which" | "tac" | "hostname" | "od" | "gzip" | "gunzip" | "zcat" | "tar" | "yq" | "xan" | "sqlite3" | "time" | "whoami";
4
4
  /** Network command names (only available when network is configured) */
5
5
  export type NetworkCommandName = "curl";
6
6
  /** All command names including network commands */
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../../types.js";
2
+ export declare const rmdirCommand: Command;
@@ -10,11 +10,13 @@ export declare enum SedTokenType {
10
10
  DOLLAR = "DOLLAR",// $ - last line
11
11
  PATTERN = "PATTERN",// /regex/
12
12
  STEP = "STEP",// first~step
13
+ RELATIVE_OFFSET = "RELATIVE_OFFSET",// +N (GNU extension: ,+N range)
13
14
  LBRACE = "LBRACE",// {
14
15
  RBRACE = "RBRACE",// }
15
16
  SEMICOLON = "SEMICOLON",// ;
16
17
  NEWLINE = "NEWLINE",
17
18
  COMMA = "COMMA",// , - address range separator
19
+ NEGATION = "NEGATION",// ! - negate address
18
20
  COMMAND = "COMMAND",// p, d, h, H, g, G, x, n, N, P, D, q, Q, z, =, l, F, v
19
21
  SUBSTITUTE = "SUBSTITUTE",// s/pattern/replacement/flags
20
22
  TRANSLITERATE = "TRANSLITERATE",// y/source/dest/
@@ -28,6 +30,7 @@ export declare enum SedTokenType {
28
30
  FILE_WRITE = "FILE_WRITE",// w filename
29
31
  FILE_WRITE_LINE = "FILE_WRITE_LINE",// W filename
30
32
  EXECUTE = "EXECUTE",// e [command]
33
+ VERSION = "VERSION",// v [version]
31
34
  EOF = "EOF",
32
35
  ERROR = "ERROR"
33
36
  }
@@ -45,6 +48,7 @@ export interface SedToken {
45
48
  command?: string;
46
49
  first?: number;
47
50
  step?: number;
51
+ offset?: number;
48
52
  line: number;
49
53
  column: number;
50
54
  }
@@ -58,9 +62,16 @@ export declare class SedLexer {
58
62
  private makeToken;
59
63
  private peek;
60
64
  private advance;
65
+ /**
66
+ * Read an escaped string until the delimiter is reached.
67
+ * Handles escape sequences: \n -> newline, \t -> tab, \X -> X
68
+ * Returns null if newline is encountered before delimiter.
69
+ */
70
+ private readEscapedString;
61
71
  private skipWhitespace;
62
72
  private nextToken;
63
73
  private readNumber;
74
+ private readRelativeOffset;
64
75
  private readPattern;
65
76
  private readLabelDef;
66
77
  private readCommand;
@@ -68,6 +79,7 @@ export declare class SedLexer {
68
79
  private readTransliterate;
69
80
  private readTextCommand;
70
81
  private readBranch;
82
+ private readVersion;
71
83
  private readFileCommand;
72
84
  private readExecute;
73
85
  private isDigit;
@@ -2,8 +2,17 @@ import type { SedCommand } from "./types.js";
2
2
  /**
3
3
  * Parse multiple sed scripts into a list of commands.
4
4
  * This is the main entry point for parsing sed scripts.
5
+ *
6
+ * Also detects #n or #r special comments at the start of the first script:
7
+ * - #n enables silent mode (equivalent to -n flag)
8
+ * - #r enables extended regex mode (equivalent to -r/-E flag)
9
+ *
10
+ * Handles backslash continuation across -e arguments:
11
+ * - If a script ends with \, the next script is treated as continuation
5
12
  */
6
13
  export declare function parseMultipleScripts(scripts: string[], extendedRegex?: boolean): {
7
14
  commands: SedCommand[];
8
15
  error?: string;
16
+ silentMode?: boolean;
17
+ extendedRegexMode?: boolean;
9
18
  };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Regex conversion utilities for sed command
3
+ */
4
+ /**
5
+ * Convert Basic Regular Expression (BRE) to Extended Regular Expression (ERE).
6
+ * In BRE: +, ?, |, (, ) are literal; \+, \?, \|, \(, \) are special
7
+ * In ERE: +, ?, |, (, ) are special; \+, \?, \|, \(, \) are literal
8
+ * Also converts POSIX character classes to JavaScript equivalents.
9
+ */
10
+ export declare function breToEre(pattern: string): string;
11
+ /**
12
+ * Normalize regex patterns for JavaScript RegExp.
13
+ * Converts GNU sed extensions to JavaScript-compatible syntax.
14
+ *
15
+ * Handles:
16
+ * - {,n} → {0,n} (GNU extension: "0 to n times")
17
+ */
18
+ export declare function normalizeForJs(pattern: string): string;
19
+ /**
20
+ * Escape pattern space for the `l` (list) command.
21
+ * Shows non-printable characters as escape sequences and ends with $.
22
+ */
23
+ export declare function escapeForList(input: string): string;
@@ -2,12 +2,16 @@ export interface StepAddress {
2
2
  first: number;
3
3
  step: number;
4
4
  }
5
+ export interface RelativeOffset {
6
+ offset: number;
7
+ }
5
8
  export type SedAddress = number | "$" | {
6
9
  pattern: string;
7
- } | StepAddress;
10
+ } | StepAddress | RelativeOffset;
8
11
  export interface AddressRange {
9
12
  start?: SedAddress;
10
13
  end?: SedAddress;
14
+ negated?: boolean;
11
15
  }
12
16
  export type SedCommandType = "substitute" | "print" | "printFirstLine" | "delete" | "deleteFirstLine" | "append" | "insert" | "change" | "hold" | "holdAppend" | "get" | "getAppend" | "exchange" | "next" | "nextAppend" | "quit" | "quitSilent" | "transliterate" | "lineNumber" | "branch" | "branchOnSubst" | "branchOnNoSubst" | "label" | "zap" | "group" | "list" | "printFilename" | "version" | "readFile" | "readFileLine" | "writeFile" | "writeFirstLine" | "execute";
13
17
  export interface SubstituteCommand {
@@ -177,10 +181,14 @@ export interface SedState {
177
181
  quit: boolean;
178
182
  quitSilent: boolean;
179
183
  exitCode?: number;
184
+ errorMessage?: string;
180
185
  appendBuffer: string[];
186
+ changedText?: string;
181
187
  substitutionMade: boolean;
182
188
  lineNumberOutput: string[];
189
+ nCommandOutput: string[];
183
190
  restartCycle: boolean;
191
+ inDRestartedCycle: boolean;
184
192
  currentFilename?: string;
185
193
  pendingFileReads: Array<{
186
194
  filename: string;
@@ -195,10 +203,14 @@ export interface SedState {
195
203
  replacePattern: boolean;
196
204
  };
197
205
  rangeStates: Map<string, RangeState>;
206
+ lastPattern?: string;
207
+ branchRequest?: string;
208
+ linesConsumedInCycle: number;
198
209
  }
199
210
  export interface RangeState {
200
211
  active: boolean;
201
212
  startLine?: number;
213
+ completed?: boolean;
202
214
  }
203
215
  export interface SedExecutionLimits {
204
216
  maxIterations: number;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Option parsing for tar command
3
+ */
4
+ import type { ExecResult } from "../../types.js";
5
+ export interface TarOptions {
6
+ create: boolean;
7
+ append: boolean;
8
+ update: boolean;
9
+ extract: boolean;
10
+ list: boolean;
11
+ file: string;
12
+ autoCompress: boolean;
13
+ gzip: boolean;
14
+ bzip2: boolean;
15
+ xz: boolean;
16
+ zstd: boolean;
17
+ verbose: boolean;
18
+ toStdout: boolean;
19
+ keepOldFiles: boolean;
20
+ touch: boolean;
21
+ directory: string;
22
+ preserve: boolean;
23
+ strip: number;
24
+ exclude: string[];
25
+ filesFrom: string;
26
+ excludeFrom: string;
27
+ wildcards: boolean;
28
+ }
29
+ export declare function parseOptions(args: string[]): {
30
+ ok: true;
31
+ options: TarOptions;
32
+ files: string[];
33
+ } | {
34
+ ok: false;
35
+ error: ExecResult;
36
+ };
@@ -0,0 +1,25 @@
1
+ import type { Command } from "../../types.js";
2
+ /**
3
+ * time - time command execution
4
+ *
5
+ * Usage: time [-f FORMAT] [-o FILE] [-a] [-v] [-p] command [arguments...]
6
+ *
7
+ * Times the execution of a command and outputs timing statistics.
8
+ *
9
+ * Options:
10
+ * -f FORMAT Use FORMAT for output (GNU time format specifiers)
11
+ * -o FILE Write timing output to FILE
12
+ * -a Append to output file (with -o)
13
+ * -v Verbose output
14
+ * -p POSIX portable output format
15
+ *
16
+ * Format specifiers:
17
+ * %e Elapsed real time in seconds
18
+ * %M Maximum resident set size (KB)
19
+ * %S System CPU time (seconds)
20
+ * %U User CPU time (seconds)
21
+ *
22
+ * Note: In this JavaScript implementation, user/system CPU time and memory
23
+ * metrics are not available, so %M, %S, %U output 0.
24
+ */
25
+ export declare const timeCommand: Command;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * whoami - print effective user name
3
+ *
4
+ * Usage: whoami
5
+ *
6
+ * In sandboxed environment, always returns "user".
7
+ */
8
+ import type { Command } from "../../types.js";
9
+ export declare const whoami: Command;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Moonblade expression tokenizer
3
+ */
4
+ export type TokenType = "int" | "float" | "string" | "regex" | "ident" | "true" | "false" | "null" | "(" | ")" | "[" | "]" | "{" | "}" | "," | ":" | ";" | "=>" | "+" | "-" | "*" | "/" | "//" | "%" | "**" | "++" | "==" | "!=" | "<" | "<=" | ">" | ">=" | "eq" | "ne" | "lt" | "le" | "gt" | "ge" | "&&" | "||" | "and" | "or" | "!" | "." | "|" | "in" | "not in" | "as" | "=" | "_" | "eof";
5
+ export interface Token {
6
+ type: TokenType;
7
+ value: string;
8
+ pos: number;
9
+ }
10
+ export declare class Tokenizer {
11
+ private input;
12
+ private pos;
13
+ private tokens;
14
+ constructor(input: string);
15
+ tokenize(): Token[];
16
+ private skipWhitespace;
17
+ private nextToken;
18
+ private match;
19
+ private isIdentStart;
20
+ private isIdentChar;
21
+ private readNumber;
22
+ private readString;
23
+ private readRegex;
24
+ private readIdentifier;
25
+ }
@@ -48,4 +48,16 @@ export declare class InMemoryFs implements IFileSystem {
48
48
  symlink(target: string, linkPath: string): Promise<void>;
49
49
  link(existingPath: string, newPath: string): Promise<void>;
50
50
  readlink(path: string): Promise<string>;
51
+ /**
52
+ * Resolve all symlinks in a path to get the canonical physical path.
53
+ * This is equivalent to POSIX realpath().
54
+ */
55
+ realpath(path: string): Promise<string>;
56
+ /**
57
+ * Set access and modification times of a file
58
+ * @param path - The file path
59
+ * @param _atime - Access time (ignored, kept for API compatibility)
60
+ * @param mtime - Modification time
61
+ */
62
+ utimes(path: string, _atime: Date, mtime: Date): Promise<void>;
51
63
  }
@@ -184,6 +184,22 @@ export interface IFileSystem {
184
184
  * @throws Error if path doesn't exist
185
185
  */
186
186
  lstat(path: string): Promise<FsStat>;
187
+ /**
188
+ * Resolve all symlinks in a path to get the canonical physical path.
189
+ * This is equivalent to POSIX realpath() - it resolves all symlinks
190
+ * in the path and returns the absolute physical path.
191
+ * Used by pwd -P and cd -P for symlink resolution.
192
+ * @throws Error if path doesn't exist or contains a broken symlink
193
+ */
194
+ realpath(path: string): Promise<string>;
195
+ /**
196
+ * Set access and modification times of a file
197
+ * @param path - The file path
198
+ * @param atime - Access time (currently ignored, kept for API compatibility)
199
+ * @param mtime - Modification time
200
+ * @throws Error if path doesn't exist
201
+ */
202
+ utimes(path: string, atime: Date, mtime: Date): Promise<void>;
187
203
  }
188
204
  /**
189
205
  * Extended file initialization options with optional metadata
@@ -101,8 +101,20 @@ export declare class MountableFs implements IFileSystem {
101
101
  symlink(target: string, linkPath: string): Promise<void>;
102
102
  link(existingPath: string, newPath: string): Promise<void>;
103
103
  readlink(path: string): Promise<string>;
104
+ /**
105
+ * Resolve all symlinks in a path to get the canonical physical path.
106
+ * This is equivalent to POSIX realpath().
107
+ */
108
+ realpath(path: string): Promise<string>;
104
109
  /**
105
110
  * Perform a cross-mount copy operation.
106
111
  */
107
112
  private crossMountCopy;
113
+ /**
114
+ * Set access and modification times of a file
115
+ * @param path - The file path
116
+ * @param atime - Access time
117
+ * @param mtime - Modification time
118
+ */
119
+ utimes(path: string, atime: Date, mtime: Date): Promise<void>;
108
120
  }
@@ -4,8 +4,8 @@
4
4
  * Reads come from the real filesystem, writes go to an in-memory layer.
5
5
  * Changes don't persist to disk and can't escape the root directory.
6
6
  */
7
+ import { type FileContent } from "../encoding.js";
7
8
  import type { CpOptions, DirentEntry, FsStat, IFileSystem, MkdirOptions, ReadFileOptions, RmOptions, WriteFileOptions } from "../interface.js";
8
- import { type FileContent } from "../utils.js";
9
9
  export interface OverlayFsOptions {
10
10
  /**
11
11
  * The root directory on the real filesystem.
@@ -104,4 +104,16 @@ export declare class OverlayFs implements IFileSystem {
104
104
  symlink(target: string, linkPath: string): Promise<void>;
105
105
  link(existingPath: string, newPath: string): Promise<void>;
106
106
  readlink(path: string): Promise<string>;
107
+ /**
108
+ * Resolve all symlinks in a path to get the canonical physical path.
109
+ * This is equivalent to POSIX realpath().
110
+ */
111
+ realpath(path: string): Promise<string>;
112
+ /**
113
+ * Set access and modification times of a file
114
+ * @param path - The file path
115
+ * @param _atime - Access time (ignored, kept for API compatibility)
116
+ * @param mtime - Modification time
117
+ */
118
+ utimes(path: string, _atime: Date, mtime: Date): Promise<void>;
107
119
  }
@@ -4,8 +4,8 @@
4
4
  * All operations go directly to the underlying Node.js filesystem.
5
5
  * This is a true read-write filesystem with no overlay or sandboxing.
6
6
  */
7
+ import { type FileContent } from "../encoding.js";
7
8
  import type { CpOptions, DirentEntry, FsStat, IFileSystem, MkdirOptions, ReadFileOptions, RmOptions, WriteFileOptions } from "../interface.js";
8
- import { type FileContent } from "../utils.js";
9
9
  export interface ReadWriteFsOptions {
10
10
  /**
11
11
  * The root directory on the real filesystem.
@@ -44,4 +44,16 @@ export declare class ReadWriteFs implements IFileSystem {
44
44
  symlink(target: string, linkPath: string): Promise<void>;
45
45
  link(existingPath: string, newPath: string): Promise<void>;
46
46
  readlink(path: string): Promise<string>;
47
+ /**
48
+ * Resolve all symlinks in a path to get the canonical physical path.
49
+ * This is equivalent to POSIX realpath().
50
+ */
51
+ realpath(path: string): Promise<string>;
52
+ /**
53
+ * Set access and modification times of a file
54
+ * @param path - The file path
55
+ * @param atime - Access time
56
+ * @param mtime - Modification time
57
+ */
58
+ utimes(path: string, atime: Date, mtime: Date): Promise<void>;
47
59
  }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Alias Expansion
3
+ *
4
+ * Handles bash alias expansion for SimpleCommandNodes.
5
+ *
6
+ * Alias expansion rules:
7
+ * 1. Only expands if command name is a literal unquoted word
8
+ * 2. Alias value is substituted for the command name
9
+ * 3. If alias value ends with a space, the next word is also checked for alias expansion
10
+ * 4. Recursive expansion is allowed but limited to prevent infinite loops
11
+ */
12
+ import type { SimpleCommandNode } from "../ast/types.js";
13
+ /**
14
+ * Context needed for alias expansion operations
15
+ */
16
+ export interface AliasExpansionContext {
17
+ env: Record<string, string | undefined>;
18
+ }
19
+ /**
20
+ * Expand alias in a SimpleCommandNode if applicable.
21
+ * Returns a new node with the alias expanded, or the original node if no expansion.
22
+ */
23
+ export declare function expandAlias(ctx: AliasExpansionContext, node: SimpleCommandNode, aliasExpansionStack: Set<string>): SimpleCommandNode;
@@ -21,9 +21,4 @@
21
21
  */
22
22
  import type { ArithExpr } from "../ast/types.js";
23
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>;
24
+ export declare function evaluateArithmetic(ctx: InterpreterContext, expr: ArithExpr, isExpansionContext?: boolean): Promise<number>;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Assignment Expansion Helpers
3
+ *
4
+ * Handles expansion of assignment arguments for local/declare/typeset builtins.
5
+ * - Array assignments: name=(elem1 elem2 ...)
6
+ * - Scalar assignments: name=value, name+=value, name[index]=value
7
+ */
8
+ import type { WordNode } from "../ast/types.js";
9
+ import type { InterpreterContext } from "./types.js";
10
+ /**
11
+ * Check if a Word represents an array assignment (name=(...)) and expand it
12
+ * while preserving quote structure for elements.
13
+ * Returns the expanded string like "name=(elem1 elem2 ...)" or null if not an array assignment.
14
+ */
15
+ export declare function expandLocalArrayAssignment(ctx: InterpreterContext, word: WordNode): Promise<string | null>;
16
+ /**
17
+ * Check if a Word represents a scalar assignment (name=value, name+=value, or name[index]=value)
18
+ * and expand it WITHOUT glob expansion on the value part.
19
+ * Returns the expanded string like "name=expanded_value" or null if not a scalar assignment.
20
+ *
21
+ * This is important for bash compatibility: `local var=$x` where x='a b' should
22
+ * set var to "a b", not try to glob-expand it.
23
+ */
24
+ export declare function expandScalarAssignmentArg(ctx: InterpreterContext, word: WordNode): Promise<string | null>;