just-bash 2.5.5 → 2.7.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 (292) hide show
  1. package/README.md +3 -3
  2. package/dist/AGENTS.md +3 -3
  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/chunks/python3-JGT65AEB.js +14 -0
  25. package/dist/bin/{shell/chunks/rg-Q4OTJOEF.js → chunks/rg-RSDLLECO.js} +1 -1
  26. package/dist/bin/chunks/rmdir-GOODLY5W.js +14 -0
  27. package/dist/bin/chunks/sed-JPDTWF4W.js +100 -0
  28. package/dist/bin/{shell/chunks/tail-BES27CZT.js → chunks/tail-YAUIERGN.js} +1 -1
  29. package/dist/bin/{shell/chunks/tar-C27YYUAS.js → chunks/tar-LFENC54A.js} +7 -7
  30. package/dist/bin/chunks/time-37F5EBPK.js +14 -0
  31. package/dist/bin/chunks/touch-IBPHJBM3.js +7 -0
  32. package/dist/bin/chunks/wc-SAOHEZYP.js +6 -0
  33. package/dist/bin/chunks/{which-73KOOLC6.js → which-FCDFBOMN.js} +1 -1
  34. package/dist/bin/chunks/whoami-JVLUNKSG.js +3 -0
  35. package/dist/bin/chunks/worker.js +1038 -0
  36. package/dist/bin/{shell/chunks/xan-6K2NGTHM.js → chunks/xan-5HNHTFMB.js} +19 -19
  37. package/dist/bin/chunks/{yq-MF2SNFGL.js → yq-PFV4T2PV.js} +1 -1
  38. package/dist/bin/just-bash.js +659 -135
  39. package/dist/bin/shell/chunks/alias-EGIS5LUE.js +7 -0
  40. package/dist/bin/shell/chunks/awk2-GFEJOWML.js +21 -0
  41. package/dist/bin/shell/chunks/bash-PGDTHIM2.js +6 -0
  42. package/dist/bin/shell/chunks/chmod-TYLTHXFR.js +9 -0
  43. package/dist/bin/shell/chunks/chunk-D5WP4CKS.js +3 -0
  44. package/dist/bin/shell/chunks/chunk-FSAGDARS.js +74 -0
  45. package/dist/bin/shell/chunks/chunk-FSZWFMB4.js +16 -0
  46. package/dist/bin/shell/chunks/chunk-IRUD2E3M.js +17 -0
  47. package/dist/bin/shell/chunks/chunk-K5IXNHO5.js +8 -0
  48. package/dist/bin/shell/chunks/chunk-KD3EODLB.js +6 -0
  49. package/dist/bin/{chunks/echo-WSKTON6U.js → shell/chunks/echo-7I42V66Q.js} +2 -2
  50. package/dist/bin/shell/chunks/env-7A4MH7BJ.js +9 -0
  51. package/dist/bin/shell/chunks/expansion-BOR3ELLC.js +2 -0
  52. package/dist/bin/{chunks/find-CBEJ35BR.js → shell/chunks/find-PHDZK64M.js} +1 -1
  53. package/dist/bin/{chunks/grep-IIVQXFNI.js → shell/chunks/grep-VX7MJMVN.js} +2 -2
  54. package/dist/bin/shell/chunks/{head-DYK37Z24.js → head-TJHLLIMR.js} +1 -1
  55. package/dist/bin/{chunks/jq-XXZPU5CA.js → shell/chunks/jq-RGZHJNXC.js} +1 -1
  56. package/dist/bin/shell/chunks/od-KRKGC2U3.js +5 -0
  57. package/dist/bin/shell/chunks/printf-YPXD4CRE.js +15 -0
  58. package/dist/bin/shell/chunks/pwd-L26WH2K4.js +3 -0
  59. package/dist/bin/shell/chunks/python3-JGT65AEB.js +14 -0
  60. package/dist/bin/{chunks/rg-Q4OTJOEF.js → shell/chunks/rg-RSDLLECO.js} +1 -1
  61. package/dist/bin/shell/chunks/rmdir-GOODLY5W.js +14 -0
  62. package/dist/bin/shell/chunks/sed-JPDTWF4W.js +100 -0
  63. package/dist/bin/{chunks/tail-BES27CZT.js → shell/chunks/tail-YAUIERGN.js} +1 -1
  64. package/dist/bin/{chunks/tar-C27YYUAS.js → shell/chunks/tar-LFENC54A.js} +7 -7
  65. package/dist/bin/shell/chunks/time-37F5EBPK.js +14 -0
  66. package/dist/bin/shell/chunks/touch-IBPHJBM3.js +7 -0
  67. package/dist/bin/shell/chunks/wc-SAOHEZYP.js +6 -0
  68. package/dist/bin/shell/chunks/{which-73KOOLC6.js → which-FCDFBOMN.js} +1 -1
  69. package/dist/bin/shell/chunks/whoami-JVLUNKSG.js +3 -0
  70. package/dist/bin/{chunks/xan-6K2NGTHM.js → shell/chunks/xan-5HNHTFMB.js} +19 -19
  71. package/dist/bin/shell/chunks/{yq-MF2SNFGL.js → yq-PFV4T2PV.js} +1 -1
  72. package/dist/bin/shell/shell.js +664 -140
  73. package/dist/bundle/browser.js +1251 -606
  74. package/dist/bundle/chunks/alias-ATFBB6D2.js +6 -0
  75. package/dist/bundle/chunks/awk2-6FBZTP57.js +20 -0
  76. package/dist/bundle/chunks/bash-OLRNM52U.js +5 -0
  77. package/dist/bundle/chunks/chmod-ODWUR7E6.js +8 -0
  78. package/dist/bundle/chunks/chunk-3AWP5CWK.js +73 -0
  79. package/dist/bundle/chunks/chunk-CXEWLFNE.js +16 -0
  80. package/dist/bundle/chunks/chunk-CZPA5RBA.js +5 -0
  81. package/dist/bundle/chunks/chunk-EEXR5ZDP.js +2 -0
  82. package/dist/bundle/chunks/chunk-HDQ56CKY.js +15 -0
  83. package/dist/bundle/chunks/chunk-PSW6BMXW.js +7 -0
  84. package/dist/bundle/chunks/{echo-VUHWYV6L.js → echo-6S7WE7XB.js} +2 -2
  85. package/dist/bundle/chunks/env-2UI6XINU.js +8 -0
  86. package/dist/bundle/chunks/expansion-RIGCFEMA.js +1 -0
  87. package/dist/bundle/chunks/{find-ACOAWALE.js → find-YGMSVGUV.js} +1 -1
  88. package/dist/bundle/chunks/{grep-ACVE42JK.js → grep-NIC6JNLH.js} +2 -2
  89. package/dist/bundle/chunks/{head-FZ6IQHYW.js → head-SA7P5NJ7.js} +1 -1
  90. package/dist/bundle/chunks/{jq-3YU5HRKE.js → jq-RLRYRPOJ.js} +1 -1
  91. package/dist/bundle/chunks/od-3FPDPLWJ.js +4 -0
  92. package/dist/bundle/chunks/printf-66XGXFCD.js +14 -0
  93. package/dist/bundle/chunks/pwd-S4NVAMC4.js +2 -0
  94. package/dist/bundle/chunks/python3-3OP7EKER.js +13 -0
  95. package/dist/bundle/chunks/{rg-YLZJWCEJ.js → rg-SRMB7L6G.js} +1 -1
  96. package/dist/bundle/chunks/rmdir-XFQE4ZYV.js +13 -0
  97. package/dist/bundle/chunks/sed-IV6HLDXU.js +99 -0
  98. package/dist/bundle/chunks/{tail-PD4RZR6J.js → tail-52LRAWXT.js} +1 -1
  99. package/dist/bundle/chunks/{tar-QWBXMF7K.js → tar-LWIHPMT6.js} +7 -7
  100. package/dist/bundle/chunks/time-UWXBG6CS.js +13 -0
  101. package/dist/bundle/chunks/touch-TDTEBHHI.js +6 -0
  102. package/dist/bundle/chunks/wc-HE5XARI4.js +5 -0
  103. package/dist/bundle/chunks/{which-M5MQ6QXQ.js → which-UBLRBDHN.js} +1 -1
  104. package/dist/bundle/chunks/whoami-YUDAIS32.js +2 -0
  105. package/dist/bundle/chunks/worker.js +1038 -0
  106. package/dist/bundle/chunks/{xan-2R2APJJ4.js → xan-A6VPI4HJ.js} +19 -19
  107. package/dist/bundle/chunks/{yq-KANM4MD2.js → yq-L665QPQU.js} +1 -1
  108. package/dist/bundle/index.js +657 -133
  109. package/dist/commands/awk/ast.d.ts +1 -0
  110. package/dist/commands/awk/interpreter/context.d.ts +14 -0
  111. package/dist/commands/awk/interpreter/interpreter.d.ts +2 -0
  112. package/dist/commands/awk/interpreter/{helpers.d.ts → type-coercion.d.ts} +4 -1
  113. package/dist/commands/awk/parser2-print.d.ts +35 -0
  114. package/dist/commands/awk/parser2.d.ts +42 -34
  115. package/dist/commands/printf/strftime.d.ts +9 -0
  116. package/dist/commands/python3/fs-bridge-handler.d.ts +50 -0
  117. package/dist/commands/python3/protocol.d.ts +138 -0
  118. package/dist/commands/python3/python3.d.ts +11 -0
  119. package/dist/commands/python3/sync-fs-backend.d.ts +59 -0
  120. package/dist/commands/python3/worker.d.ts +16 -0
  121. package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
  122. package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
  123. package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
  124. package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
  125. package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
  126. package/dist/commands/query-engine/builtins/index.d.ts +17 -0
  127. package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
  128. package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
  129. package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
  130. package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
  131. package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
  132. package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
  133. package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
  134. package/dist/commands/query-engine/evaluator.d.ts +10 -2
  135. package/dist/commands/query-engine/parser-types.d.ts +171 -0
  136. package/dist/commands/query-engine/parser.d.ts +2 -132
  137. package/dist/commands/query-engine/path-operations.d.ts +15 -0
  138. package/dist/commands/query-engine/value-operations.d.ts +39 -0
  139. package/dist/commands/registry.d.ts +1 -1
  140. package/dist/commands/rmdir/rmdir.d.ts +2 -0
  141. package/dist/commands/sed/lexer.d.ts +12 -0
  142. package/dist/commands/sed/parser.d.ts +9 -0
  143. package/dist/commands/sed/sed-regex.d.ts +23 -0
  144. package/dist/commands/sed/types.d.ts +13 -1
  145. package/dist/commands/tar/tar-options.d.ts +36 -0
  146. package/dist/commands/time/time.d.ts +25 -0
  147. package/dist/commands/whoami/whoami.d.ts +9 -0
  148. package/dist/commands/xan/moonblade-tokenizer.d.ts +25 -0
  149. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +12 -0
  150. package/dist/fs/interface.d.ts +16 -0
  151. package/dist/fs/mountable-fs/mountable-fs.d.ts +12 -0
  152. package/dist/fs/overlay-fs/overlay-fs.d.ts +13 -1
  153. package/dist/fs/read-write-fs/read-write-fs.d.ts +13 -1
  154. package/dist/interpreter/alias-expansion.d.ts +23 -0
  155. package/dist/interpreter/arithmetic.d.ts +1 -6
  156. package/dist/interpreter/assignment-expansion.d.ts +24 -0
  157. package/dist/interpreter/builtin-dispatch.d.ts +39 -0
  158. package/dist/interpreter/builtins/compgen.d.ts +26 -0
  159. package/dist/interpreter/builtins/complete.d.ts +17 -0
  160. package/dist/interpreter/builtins/compopt.d.ts +28 -0
  161. package/dist/interpreter/builtins/declare-array-parsing.d.ts +14 -0
  162. package/dist/interpreter/builtins/declare-print.d.ts +39 -0
  163. package/dist/interpreter/builtins/declare.d.ts +10 -4
  164. package/dist/interpreter/builtins/dirs.d.ts +29 -0
  165. package/dist/interpreter/builtins/eval.d.ts +1 -1
  166. package/dist/interpreter/builtins/export.d.ts +1 -0
  167. package/dist/interpreter/builtins/getopts.d.ts +18 -0
  168. package/dist/interpreter/builtins/hash.d.ts +19 -0
  169. package/dist/interpreter/builtins/help.d.ts +12 -0
  170. package/dist/interpreter/builtins/index.d.ts +9 -1
  171. package/dist/interpreter/builtins/local.d.ts +1 -1
  172. package/dist/interpreter/builtins/read.d.ts +1 -1
  173. package/dist/interpreter/builtins/set.d.ts +3 -0
  174. package/dist/interpreter/builtins/shift.d.ts +3 -0
  175. package/dist/interpreter/builtins/shopt.d.ts +7 -0
  176. package/dist/interpreter/builtins/unset.d.ts +5 -1
  177. package/dist/interpreter/builtins/variable-assignment.d.ts +66 -0
  178. package/dist/interpreter/command-resolution.d.ts +43 -0
  179. package/dist/interpreter/conditionals.d.ts +1 -1
  180. package/dist/interpreter/errors.d.ts +36 -1
  181. package/dist/interpreter/expansion/analysis.d.ts +15 -17
  182. package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
  183. package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
  184. package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
  185. package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
  186. package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
  187. package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
  188. package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
  189. package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
  190. package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
  191. package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
  192. package/dist/interpreter/expansion/pattern-removal.d.ts +18 -0
  193. package/dist/interpreter/expansion/pattern.d.ts +2 -1
  194. package/dist/interpreter/expansion/positional-params.d.ts +59 -0
  195. package/dist/interpreter/expansion/prompt.d.ts +39 -0
  196. package/dist/interpreter/expansion/quoting.d.ts +13 -0
  197. package/dist/interpreter/expansion/tilde.d.ts +12 -0
  198. package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
  199. package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
  200. package/dist/interpreter/expansion/variable.d.ts +10 -1
  201. package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
  202. package/dist/interpreter/expansion/word-split.d.ts +11 -6
  203. package/dist/interpreter/expansion.d.ts +30 -4
  204. package/dist/interpreter/functions.d.ts +1 -1
  205. package/dist/interpreter/helpers/array.d.ts +20 -0
  206. package/dist/interpreter/helpers/ifs.d.ts +66 -5
  207. package/dist/interpreter/helpers/nameref.d.ts +65 -0
  208. package/dist/interpreter/helpers/quoting.d.ts +24 -0
  209. package/dist/interpreter/helpers/readonly.d.ts +28 -4
  210. package/dist/interpreter/helpers/shell-constants.d.ts +25 -0
  211. package/dist/interpreter/helpers/shellopts.d.ts +28 -0
  212. package/dist/interpreter/helpers/string-compare.d.ts +3 -1
  213. package/dist/interpreter/helpers/tilde.d.ts +13 -0
  214. package/dist/interpreter/helpers/variable-tests.d.ts +1 -1
  215. package/dist/interpreter/helpers/word-matching.d.ts +26 -0
  216. package/dist/interpreter/helpers/xtrace.d.ts +18 -0
  217. package/dist/interpreter/interpreter.d.ts +13 -14
  218. package/dist/interpreter/pipeline-execution.d.ts +16 -0
  219. package/dist/interpreter/redirections.d.ts +38 -1
  220. package/dist/interpreter/simple-command-assignments.d.ts +29 -0
  221. package/dist/interpreter/subshell-group.d.ts +32 -0
  222. package/dist/interpreter/type-command.d.ts +37 -0
  223. package/dist/interpreter/types.d.ts +255 -21
  224. package/dist/limits.d.ts +2 -0
  225. package/dist/parser/arithmetic-parser.d.ts +2 -4
  226. package/dist/parser/arithmetic-primaries.d.ts +45 -0
  227. package/dist/parser/compound-parser.d.ts +21 -7
  228. package/dist/parser/expansion-parser.d.ts +7 -1
  229. package/dist/parser/lexer.d.ts +57 -0
  230. package/dist/parser/parser-substitution.d.ts +62 -0
  231. package/dist/parser/parser.d.ts +39 -2
  232. package/dist/parser/types.d.ts +1 -0
  233. package/dist/types.d.ts +17 -0
  234. package/package.json +10 -5
  235. package/dist/bin/chunks/alias-PCMLRCRW.js +0 -7
  236. package/dist/bin/chunks/awk2-D2US2LMM.js +0 -20
  237. package/dist/bin/chunks/bash-UT3MT5UU.js +0 -7
  238. package/dist/bin/chunks/chmod-3DIKREF7.js +0 -9
  239. package/dist/bin/chunks/chunk-ACRTDIBO.js +0 -6
  240. package/dist/bin/chunks/chunk-DV5HL4K2.js +0 -17
  241. package/dist/bin/chunks/chunk-J7BCMQDI.js +0 -16
  242. package/dist/bin/chunks/chunk-NWWB2XRE.js +0 -6
  243. package/dist/bin/chunks/chunk-PM2DS2YW.js +0 -3
  244. package/dist/bin/chunks/env-YLLSNZZN.js +0 -9
  245. package/dist/bin/chunks/od-SLM7SRWU.js +0 -7
  246. package/dist/bin/chunks/printf-HWUQKYUM.js +0 -14
  247. package/dist/bin/chunks/pwd-53KG2MCJ.js +0 -3
  248. package/dist/bin/chunks/sed-5LQMJYRJ.js +0 -80
  249. package/dist/bin/chunks/touch-TSNAXMZ2.js +0 -4
  250. package/dist/bin/chunks/wc-QSBRKIF5.js +0 -6
  251. package/dist/bin/shell/chunks/alias-PCMLRCRW.js +0 -7
  252. package/dist/bin/shell/chunks/awk2-D2US2LMM.js +0 -20
  253. package/dist/bin/shell/chunks/bash-UT3MT5UU.js +0 -7
  254. package/dist/bin/shell/chunks/chmod-3DIKREF7.js +0 -9
  255. package/dist/bin/shell/chunks/chunk-ACRTDIBO.js +0 -6
  256. package/dist/bin/shell/chunks/chunk-DV5HL4K2.js +0 -17
  257. package/dist/bin/shell/chunks/chunk-J7BCMQDI.js +0 -16
  258. package/dist/bin/shell/chunks/chunk-NWWB2XRE.js +0 -6
  259. package/dist/bin/shell/chunks/chunk-PM2DS2YW.js +0 -3
  260. package/dist/bin/shell/chunks/env-YLLSNZZN.js +0 -9
  261. package/dist/bin/shell/chunks/od-SLM7SRWU.js +0 -7
  262. package/dist/bin/shell/chunks/printf-HWUQKYUM.js +0 -14
  263. package/dist/bin/shell/chunks/pwd-53KG2MCJ.js +0 -3
  264. package/dist/bin/shell/chunks/sed-5LQMJYRJ.js +0 -80
  265. package/dist/bin/shell/chunks/touch-TSNAXMZ2.js +0 -4
  266. package/dist/bin/shell/chunks/wc-QSBRKIF5.js +0 -6
  267. package/dist/bundle/chunks/alias-4UGRF4DM.js +0 -6
  268. package/dist/bundle/chunks/awk2-46RTIZKB.js +0 -19
  269. package/dist/bundle/chunks/bash-ZILV3VHA.js +0 -6
  270. package/dist/bundle/chunks/chmod-FBHLEIY6.js +0 -8
  271. package/dist/bundle/chunks/chunk-4JO5BKO4.js +0 -5
  272. package/dist/bundle/chunks/chunk-BOJ3OAZB.js +0 -16
  273. package/dist/bundle/chunks/chunk-CG2HXOFG.js +0 -5
  274. package/dist/bundle/chunks/chunk-NWEGHOXL.js +0 -2
  275. package/dist/bundle/chunks/chunk-W2EKKAIL.js +0 -15
  276. package/dist/bundle/chunks/env-EG5SQSAQ.js +0 -8
  277. package/dist/bundle/chunks/od-ECWXNUB4.js +0 -6
  278. package/dist/bundle/chunks/printf-VG2POOXB.js +0 -13
  279. package/dist/bundle/chunks/pwd-AC4P3JKI.js +0 -2
  280. package/dist/bundle/chunks/sed-ZKODWZ6F.js +0 -79
  281. package/dist/bundle/chunks/touch-MVQSKQKT.js +0 -3
  282. package/dist/bundle/chunks/wc-DFQKWSIZ.js +0 -5
  283. package/dist/interpreter/builtins/variable-helpers.d.ts +0 -30
  284. /package/dist/bin/chunks/{curl-LCMREE7R.js → curl-TH7YRBSA.js} +0 -0
  285. /package/dist/bin/chunks/{file-LNCFDPQZ.js → file-6PCTL3MH.js} +0 -0
  286. /package/dist/bin/shell/chunks/{curl-LCMREE7R.js → curl-TH7YRBSA.js} +0 -0
  287. /package/dist/bin/shell/chunks/{file-LNCFDPQZ.js → file-6PCTL3MH.js} +0 -0
  288. /package/dist/bundle/chunks/{curl-TVZH24MD.js → curl-XLP4VABU.js} +0 -0
  289. /package/dist/bundle/chunks/{file-XPA6O6H2.js → file-NQP3CKRV.js} +0 -0
  290. /package/dist/commands/curl/{utils.d.ts → response-formatting.d.ts} +0 -0
  291. /package/dist/commands/xan/{xan-utils.d.ts → column-selection.d.ts} +0 -0
  292. /package/dist/fs/{utils.d.ts → encoding.d.ts} +0 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Path-related jq builtins
3
+ *
4
+ * Handles path manipulation functions like getpath, setpath, delpaths, paths, etc.
5
+ */
6
+ import type { EvalContext } from "../evaluator.js";
7
+ import type { AstNode } from "../parser.js";
8
+ import type { QueryValue } from "../value-operations.js";
9
+ type EvalFn = (value: QueryValue, ast: AstNode, ctx: EvalContext) => QueryValue[];
10
+ type IsTruthyFn = (v: QueryValue) => boolean;
11
+ type SetPathFn = (obj: QueryValue, path: (string | number)[], val: QueryValue) => QueryValue;
12
+ type DeletePathFn = (obj: QueryValue, path: (string | number)[]) => QueryValue;
13
+ type ApplyDelFn = (value: QueryValue, expr: AstNode, ctx: EvalContext) => QueryValue;
14
+ type CollectPathsFn = (value: QueryValue, expr: AstNode, ctx: EvalContext, currentPath: (string | number)[], paths: (string | number)[][]) => void;
15
+ /**
16
+ * Handle path builtins that need evaluate function for arguments.
17
+ * Returns null if the builtin name is not a path builtin handled here.
18
+ */
19
+ export declare function evalPathBuiltin(value: QueryValue, name: string, args: AstNode[], ctx: EvalContext, evaluate: EvalFn, isTruthy: IsTruthyFn, setPath: SetPathFn, deletePath: DeletePathFn, applyDel: ApplyDelFn, collectPaths: CollectPathsFn): QueryValue[] | null;
20
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * SQL-like jq builtins
3
+ *
4
+ * Handles IN, INDEX, and JOIN functions.
5
+ */
6
+ import type { EvalContext } from "../evaluator.js";
7
+ import type { AstNode } from "../parser.js";
8
+ import type { QueryValue } from "../value-operations.js";
9
+ type EvalFn = (value: QueryValue, ast: AstNode, ctx: EvalContext) => QueryValue[];
10
+ type DeepEqualFn = (a: QueryValue, b: QueryValue) => boolean;
11
+ /**
12
+ * Handle SQL-like builtins that need evaluate function for arguments.
13
+ * Returns null if the builtin name is not a SQL builtin handled here.
14
+ */
15
+ export declare function evalSqlBuiltin(value: QueryValue, name: string, args: AstNode[], ctx: EvalContext, evaluate: EvalFn, deepEqual: DeepEqualFn): QueryValue[] | null;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * String-related jq builtins
3
+ *
4
+ * Handles string manipulation functions like join, split, test, match, gsub, etc.
5
+ */
6
+ import type { EvalContext } from "../evaluator.js";
7
+ import type { AstNode } from "../parser.js";
8
+ import type { QueryValue } from "../value-operations.js";
9
+ type EvalFn = (value: QueryValue, ast: AstNode, ctx: EvalContext) => QueryValue[];
10
+ /**
11
+ * Handle string builtins that need evaluate function for arguments.
12
+ * Returns null if the builtin name is not a string builtin handled here.
13
+ */
14
+ export declare function evalStringBuiltin(value: QueryValue, name: string, args: AstNode[], ctx: EvalContext, evaluate: EvalFn): QueryValue[] | null;
15
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Type-related jq builtins
3
+ *
4
+ * Handles type checking and type filtering functions like type, numbers, strings, etc.
5
+ */
6
+ import type { QueryValue } from "../value-operations.js";
7
+ /**
8
+ * Handle type builtins.
9
+ * Returns null if the builtin name is not a type builtin handled here.
10
+ */
11
+ export declare function evalTypeBuiltin(value: QueryValue, name: string): QueryValue[] | null;
@@ -5,18 +5,26 @@
5
5
  * Used by jq, yq, and other query-based commands.
6
6
  */
7
7
  import type { AstNode } from "./parser.js";
8
- export type QueryValue = unknown;
8
+ import { type QueryValue } from "./value-operations.js";
9
+ export type { QueryValue } from "./value-operations.js";
9
10
  export interface QueryExecutionLimits {
10
11
  maxIterations?: number;
12
+ maxDepth?: number;
11
13
  }
12
14
  export interface EvalContext {
13
15
  vars: Map<string, QueryValue>;
14
- limits: Required<QueryExecutionLimits>;
16
+ limits: Required<Pick<QueryExecutionLimits, "maxIterations">> & QueryExecutionLimits;
15
17
  env?: Record<string, string | undefined>;
16
18
  /** Original document root for parent/root navigation */
17
19
  root?: QueryValue;
18
20
  /** Current path from root for parent navigation */
19
21
  currentPath?: (string | number)[];
22
+ funcs?: Map<string, {
23
+ params: string[];
24
+ body: AstNode;
25
+ closure?: Map<string, unknown>;
26
+ }>;
27
+ labels?: Set<string>;
20
28
  }
21
29
  export interface EvaluateOptions {
22
30
  limits?: QueryExecutionLimits;
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Query expression parser types
3
+ *
4
+ * AST node types and token types for jq-style filter expressions.
5
+ */
6
+ 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" | "LABEL" | "BREAK" | "DEF" | "DOTDOT" | "EOF";
7
+ export interface Token {
8
+ type: TokenType;
9
+ value?: string | number;
10
+ pos: number;
11
+ }
12
+ 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 | LabelNode | BreakNode | DefNode;
13
+ export interface IdentityNode {
14
+ type: "Identity";
15
+ }
16
+ export interface FieldNode {
17
+ type: "Field";
18
+ name: string;
19
+ base?: AstNode;
20
+ }
21
+ export interface IndexNode {
22
+ type: "Index";
23
+ index: AstNode;
24
+ base?: AstNode;
25
+ }
26
+ export interface SliceNode {
27
+ type: "Slice";
28
+ start?: AstNode;
29
+ end?: AstNode;
30
+ base?: AstNode;
31
+ }
32
+ export interface IterateNode {
33
+ type: "Iterate";
34
+ base?: AstNode;
35
+ }
36
+ export interface PipeNode {
37
+ type: "Pipe";
38
+ left: AstNode;
39
+ right: AstNode;
40
+ }
41
+ export interface CommaNode {
42
+ type: "Comma";
43
+ left: AstNode;
44
+ right: AstNode;
45
+ }
46
+ export interface LiteralNode {
47
+ type: "Literal";
48
+ value: unknown;
49
+ }
50
+ export interface ArrayNode {
51
+ type: "Array";
52
+ elements?: AstNode;
53
+ }
54
+ export interface ObjectNode {
55
+ type: "Object";
56
+ entries: {
57
+ key: AstNode | string;
58
+ value: AstNode;
59
+ }[];
60
+ }
61
+ export interface ParenNode {
62
+ type: "Paren";
63
+ expr: AstNode;
64
+ }
65
+ export interface BinaryOpNode {
66
+ type: "BinaryOp";
67
+ op: "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | "<=" | ">" | ">=" | "and" | "or" | "//";
68
+ left: AstNode;
69
+ right: AstNode;
70
+ }
71
+ export interface UnaryOpNode {
72
+ type: "UnaryOp";
73
+ op: "-" | "not";
74
+ operand: AstNode;
75
+ }
76
+ export interface CondNode {
77
+ type: "Cond";
78
+ cond: AstNode;
79
+ then: AstNode;
80
+ elifs: {
81
+ cond: AstNode;
82
+ then: AstNode;
83
+ }[];
84
+ else?: AstNode;
85
+ }
86
+ export interface TryNode {
87
+ type: "Try";
88
+ body: AstNode;
89
+ catch?: AstNode;
90
+ }
91
+ export interface CallNode {
92
+ type: "Call";
93
+ name: string;
94
+ args: AstNode[];
95
+ }
96
+ export interface VarBindNode {
97
+ type: "VarBind";
98
+ name: string;
99
+ value: AstNode;
100
+ body: AstNode;
101
+ pattern?: DestructurePattern;
102
+ alternatives?: DestructurePattern[];
103
+ }
104
+ export type DestructurePattern = {
105
+ type: "var";
106
+ name: string;
107
+ } | {
108
+ type: "array";
109
+ elements: DestructurePattern[];
110
+ } | {
111
+ type: "object";
112
+ fields: {
113
+ key: string | AstNode;
114
+ pattern: DestructurePattern;
115
+ keyVar?: string;
116
+ }[];
117
+ };
118
+ export interface VarRefNode {
119
+ type: "VarRef";
120
+ name: string;
121
+ }
122
+ export interface RecurseNode {
123
+ type: "Recurse";
124
+ }
125
+ export interface OptionalNode {
126
+ type: "Optional";
127
+ expr: AstNode;
128
+ }
129
+ export interface StringInterpNode {
130
+ type: "StringInterp";
131
+ parts: (string | AstNode)[];
132
+ }
133
+ export interface UpdateOpNode {
134
+ type: "UpdateOp";
135
+ op: "+=" | "-=" | "*=" | "/=" | "%=" | "//=" | "=" | "|=";
136
+ path: AstNode;
137
+ value: AstNode;
138
+ }
139
+ export interface ReduceNode {
140
+ type: "Reduce";
141
+ expr: AstNode;
142
+ varName: string;
143
+ pattern?: DestructurePattern;
144
+ init: AstNode;
145
+ update: AstNode;
146
+ }
147
+ export interface ForeachNode {
148
+ type: "Foreach";
149
+ expr: AstNode;
150
+ varName: string;
151
+ pattern?: DestructurePattern;
152
+ init: AstNode;
153
+ update: AstNode;
154
+ extract?: AstNode;
155
+ }
156
+ export interface LabelNode {
157
+ type: "Label";
158
+ name: string;
159
+ body: AstNode;
160
+ }
161
+ export interface BreakNode {
162
+ type: "Break";
163
+ name: string;
164
+ }
165
+ export interface DefNode {
166
+ type: "Def";
167
+ name: string;
168
+ params: string[];
169
+ funcBody: AstNode;
170
+ body: AstNode;
171
+ }
@@ -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" | "python3" | "python";
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
+ };