just-bash 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +326 -0
- package/dist/Bash.d.ts +90 -0
- package/dist/ai/index.d.ts +56 -0
- package/dist/ast/types.d.ts +518 -0
- package/dist/bin/chunks/alias-74DFXE2E.js +7 -0
- package/dist/bin/chunks/awk-S63F6IYK.js +15 -0
- package/dist/bin/chunks/base64-NC7HTKLZ.js +5 -0
- package/dist/bin/chunks/basename-Y7JDBYHN.js +6 -0
- package/dist/bin/chunks/bash-TQGTNXAE.js +7 -0
- package/dist/bin/chunks/cat-YZXBF5YF.js +6 -0
- package/dist/bin/chunks/chmod-3G4LK462.js +9 -0
- package/dist/bin/chunks/chunk-26Q3PZQ6.js +2 -0
- package/dist/bin/chunks/chunk-4VDEBYW7.js +2 -0
- package/dist/bin/chunks/chunk-5KNEBKYN.js +2 -0
- package/dist/bin/chunks/chunk-GTNBSMZR.js +23 -0
- package/dist/bin/chunks/chunk-J7BCMQDI.js +16 -0
- package/dist/bin/chunks/chunk-J7MJV6WO.js +3 -0
- package/dist/bin/chunks/chunk-LV662IGP.js +6 -0
- package/dist/bin/chunks/chunk-TA7RUHGQ.js +4 -0
- package/dist/bin/chunks/clear-GTCFHSB2.js +2 -0
- package/dist/bin/chunks/cp-77UY7PGN.js +8 -0
- package/dist/bin/chunks/curl-NE7XEWMN.js +26 -0
- package/dist/bin/chunks/cut-UYV3FM7R.js +6 -0
- package/dist/bin/chunks/date-7NBRXV2Z.js +5 -0
- package/dist/bin/chunks/diff-TG2NXCX2.js +19 -0
- package/dist/bin/chunks/dirname-VLHP44TU.js +5 -0
- package/dist/bin/chunks/du-4FZ7WF2P.js +8 -0
- package/dist/bin/chunks/echo-DEUIS5JO.js +4 -0
- package/dist/bin/chunks/env-FVITWNHG.js +9 -0
- package/dist/bin/chunks/expr-HA2ZNL6S.js +5 -0
- package/dist/bin/chunks/find-4B67H4RP.js +11 -0
- package/dist/bin/chunks/grep-OVWU4WCZ.js +15 -0
- package/dist/bin/chunks/head-VGXR3WWL.js +2 -0
- package/dist/bin/chunks/help-5V3MPCYQ.js +16 -0
- package/dist/bin/chunks/history-PRQ4B6N2.js +3 -0
- package/dist/bin/chunks/html-to-markdown-L4UWMK4S.js +84 -0
- package/dist/bin/chunks/jq-EYSXBSCP.js +14 -0
- package/dist/bin/chunks/ln-DB7J2W5X.js +10 -0
- package/dist/bin/chunks/ls-C4MPAF3H.js +26 -0
- package/dist/bin/chunks/mkdir-LWULWDHP.js +7 -0
- package/dist/bin/chunks/mv-TDYCNSIQ.js +7 -0
- package/dist/bin/chunks/paste-R36J3G4K.js +8 -0
- package/dist/bin/chunks/printf-BOFQVMMK.js +15 -0
- package/dist/bin/chunks/pwd-X4MWD4JP.js +3 -0
- package/dist/bin/chunks/readlink-DPNOQY67.js +7 -0
- package/dist/bin/chunks/rm-W6CCBEMG.js +8 -0
- package/dist/bin/chunks/sed-7IS44XON.js +48 -0
- package/dist/bin/chunks/seq-DGJILX2Q.js +7 -0
- package/dist/bin/chunks/sleep-E4DIYGTT.js +10 -0
- package/dist/bin/chunks/sort-UJP353TM.js +15 -0
- package/dist/bin/chunks/stat-3PHITCPO.js +9 -0
- package/dist/bin/chunks/tail-YSVKBQ77.js +2 -0
- package/dist/bin/chunks/tee-UU2VS3OM.js +3 -0
- package/dist/bin/chunks/timeout-OZVAGW2H.js +12 -0
- package/dist/bin/chunks/touch-XCIAYF5I.js +4 -0
- package/dist/bin/chunks/tr-2EEKHHO6.js +20 -0
- package/dist/bin/chunks/tree-4247W67O.js +12 -0
- package/dist/bin/chunks/true-JCX733LK.js +2 -0
- package/dist/bin/chunks/uniq-W4HF6YSB.js +5 -0
- package/dist/bin/chunks/wc-CNJ3QDRA.js +6 -0
- package/dist/bin/chunks/which-HX2NMOP3.js +3 -0
- package/dist/bin/chunks/xargs-YNLVLPOF.js +4 -0
- package/dist/bin/just-bash.js +188 -0
- package/dist/bin/shell/chunks/alias-74DFXE2E.js +7 -0
- package/dist/bin/shell/chunks/awk-S63F6IYK.js +15 -0
- package/dist/bin/shell/chunks/base64-NC7HTKLZ.js +5 -0
- package/dist/bin/shell/chunks/basename-Y7JDBYHN.js +6 -0
- package/dist/bin/shell/chunks/bash-TQGTNXAE.js +7 -0
- package/dist/bin/shell/chunks/cat-YZXBF5YF.js +6 -0
- package/dist/bin/shell/chunks/chmod-3G4LK462.js +9 -0
- package/dist/bin/shell/chunks/chunk-26Q3PZQ6.js +2 -0
- package/dist/bin/shell/chunks/chunk-4VDEBYW7.js +2 -0
- package/dist/bin/shell/chunks/chunk-5KNEBKYN.js +2 -0
- package/dist/bin/shell/chunks/chunk-GTNBSMZR.js +23 -0
- package/dist/bin/shell/chunks/chunk-J7BCMQDI.js +16 -0
- package/dist/bin/shell/chunks/chunk-J7MJV6WO.js +3 -0
- package/dist/bin/shell/chunks/chunk-LV662IGP.js +6 -0
- package/dist/bin/shell/chunks/chunk-TA7RUHGQ.js +4 -0
- package/dist/bin/shell/chunks/clear-GTCFHSB2.js +2 -0
- package/dist/bin/shell/chunks/cp-77UY7PGN.js +8 -0
- package/dist/bin/shell/chunks/curl-NE7XEWMN.js +26 -0
- package/dist/bin/shell/chunks/cut-UYV3FM7R.js +6 -0
- package/dist/bin/shell/chunks/date-7NBRXV2Z.js +5 -0
- package/dist/bin/shell/chunks/diff-TG2NXCX2.js +19 -0
- package/dist/bin/shell/chunks/dirname-VLHP44TU.js +5 -0
- package/dist/bin/shell/chunks/du-4FZ7WF2P.js +8 -0
- package/dist/bin/shell/chunks/echo-DEUIS5JO.js +4 -0
- package/dist/bin/shell/chunks/env-FVITWNHG.js +9 -0
- package/dist/bin/shell/chunks/expr-HA2ZNL6S.js +5 -0
- package/dist/bin/shell/chunks/find-4B67H4RP.js +11 -0
- package/dist/bin/shell/chunks/grep-OVWU4WCZ.js +15 -0
- package/dist/bin/shell/chunks/head-VGXR3WWL.js +2 -0
- package/dist/bin/shell/chunks/help-5V3MPCYQ.js +16 -0
- package/dist/bin/shell/chunks/history-PRQ4B6N2.js +3 -0
- package/dist/bin/shell/chunks/html-to-markdown-L4UWMK4S.js +84 -0
- package/dist/bin/shell/chunks/jq-EYSXBSCP.js +14 -0
- package/dist/bin/shell/chunks/ln-DB7J2W5X.js +10 -0
- package/dist/bin/shell/chunks/ls-C4MPAF3H.js +26 -0
- package/dist/bin/shell/chunks/mkdir-LWULWDHP.js +7 -0
- package/dist/bin/shell/chunks/mv-TDYCNSIQ.js +7 -0
- package/dist/bin/shell/chunks/paste-R36J3G4K.js +8 -0
- package/dist/bin/shell/chunks/printf-BOFQVMMK.js +15 -0
- package/dist/bin/shell/chunks/pwd-X4MWD4JP.js +3 -0
- package/dist/bin/shell/chunks/readlink-DPNOQY67.js +7 -0
- package/dist/bin/shell/chunks/rm-W6CCBEMG.js +8 -0
- package/dist/bin/shell/chunks/sed-7IS44XON.js +48 -0
- package/dist/bin/shell/chunks/seq-DGJILX2Q.js +7 -0
- package/dist/bin/shell/chunks/sleep-E4DIYGTT.js +10 -0
- package/dist/bin/shell/chunks/sort-UJP353TM.js +15 -0
- package/dist/bin/shell/chunks/stat-3PHITCPO.js +9 -0
- package/dist/bin/shell/chunks/tail-YSVKBQ77.js +2 -0
- package/dist/bin/shell/chunks/tee-UU2VS3OM.js +3 -0
- package/dist/bin/shell/chunks/timeout-OZVAGW2H.js +12 -0
- package/dist/bin/shell/chunks/touch-XCIAYF5I.js +4 -0
- package/dist/bin/shell/chunks/tr-2EEKHHO6.js +20 -0
- package/dist/bin/shell/chunks/tree-4247W67O.js +12 -0
- package/dist/bin/shell/chunks/true-JCX733LK.js +2 -0
- package/dist/bin/shell/chunks/uniq-W4HF6YSB.js +5 -0
- package/dist/bin/shell/chunks/wc-CNJ3QDRA.js +6 -0
- package/dist/bin/shell/chunks/which-HX2NMOP3.js +3 -0
- package/dist/bin/shell/chunks/xargs-YNLVLPOF.js +4 -0
- package/dist/bin/shell/shell.js +172 -0
- package/dist/bundle/ai/index.js +541 -0
- package/dist/bundle/chunks/alias-7ZSTROM7.js +6 -0
- package/dist/bundle/chunks/awk-V4C3GTJI.js +14 -0
- package/dist/bundle/chunks/base64-WATI5PWI.js +4 -0
- package/dist/bundle/chunks/basename-SB5JXIY3.js +5 -0
- package/dist/bundle/chunks/bash-T4PXVRYX.js +6 -0
- package/dist/bundle/chunks/cat-5KESXK2M.js +5 -0
- package/dist/bundle/chunks/chmod-VLKWIL3N.js +8 -0
- package/dist/bundle/chunks/chunk-3YNHMZ5M.js +2 -0
- package/dist/bundle/chunks/chunk-44UOCSGV.js +1 -0
- package/dist/bundle/chunks/chunk-74CEPOFO.js +22 -0
- package/dist/bundle/chunks/chunk-JYYFSUWP.js +5 -0
- package/dist/bundle/chunks/chunk-UJMN5NLH.js +1 -0
- package/dist/bundle/chunks/chunk-W2EKKAIL.js +15 -0
- package/dist/bundle/chunks/chunk-ZVV5VXYZ.js +3 -0
- package/dist/bundle/chunks/clear-ZBD2DMXN.js +1 -0
- package/dist/bundle/chunks/cp-BLHAPLQZ.js +7 -0
- package/dist/bundle/chunks/curl-PA2MWGKN.js +25 -0
- package/dist/bundle/chunks/cut-7RHEYJ7Y.js +5 -0
- package/dist/bundle/chunks/date-YOOSNZVA.js +4 -0
- package/dist/bundle/chunks/diff-IVJFQANX.js +6 -0
- package/dist/bundle/chunks/dirname-Q5HDZLH2.js +4 -0
- package/dist/bundle/chunks/du-I5HYAKTQ.js +7 -0
- package/dist/bundle/chunks/echo-W2TA2N7Y.js +3 -0
- package/dist/bundle/chunks/env-OORA5GFS.js +8 -0
- package/dist/bundle/chunks/expr-A4LJAGVP.js +4 -0
- package/dist/bundle/chunks/find-K3NO35MZ.js +10 -0
- package/dist/bundle/chunks/grep-3D2INI4S.js +14 -0
- package/dist/bundle/chunks/head-7H5R4WKO.js +1 -0
- package/dist/bundle/chunks/help-SDCRRU2F.js +15 -0
- package/dist/bundle/chunks/history-7Z2STZ6Y.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-XMBYO6FD.js +4 -0
- package/dist/bundle/chunks/jq-7R2XGLLH.js +13 -0
- package/dist/bundle/chunks/ln-UTUVIAFP.js +9 -0
- package/dist/bundle/chunks/ls-B7C35UDO.js +23 -0
- package/dist/bundle/chunks/mkdir-WYI2LJ6H.js +6 -0
- package/dist/bundle/chunks/mv-GN23UIZU.js +6 -0
- package/dist/bundle/chunks/paste-L4TYPVSP.js +7 -0
- package/dist/bundle/chunks/printf-3ZT5XOIZ.js +14 -0
- package/dist/bundle/chunks/pwd-ZVX5RTL4.js +2 -0
- package/dist/bundle/chunks/readlink-HHC33N5C.js +6 -0
- package/dist/bundle/chunks/rm-5X2XSQQ6.js +7 -0
- package/dist/bundle/chunks/sed-UZJSXYQZ.js +47 -0
- package/dist/bundle/chunks/seq-TFPZQZPJ.js +6 -0
- package/dist/bundle/chunks/sleep-QJBQD6VS.js +9 -0
- package/dist/bundle/chunks/sort-LHMQWYH2.js +14 -0
- package/dist/bundle/chunks/stat-TM5F5YO4.js +8 -0
- package/dist/bundle/chunks/tail-BLGGG2VX.js +1 -0
- package/dist/bundle/chunks/tee-VCNOG5VI.js +2 -0
- package/dist/bundle/chunks/timeout-THAT7IOO.js +11 -0
- package/dist/bundle/chunks/touch-Z5XRYFYY.js +3 -0
- package/dist/bundle/chunks/tr-UV4V27RJ.js +19 -0
- package/dist/bundle/chunks/tree-75UXQ4XJ.js +11 -0
- package/dist/bundle/chunks/true-OD7ZXH3O.js +1 -0
- package/dist/bundle/chunks/uniq-IIOQKNTS.js +4 -0
- package/dist/bundle/chunks/wc-OXLYBRUE.js +5 -0
- package/dist/bundle/chunks/which-ONWH3TNF.js +2 -0
- package/dist/bundle/chunks/xargs-E5JPQL24.js +3 -0
- package/dist/bundle/index.js +141 -0
- package/dist/commands/alias/alias.d.ts +3 -0
- package/dist/commands/awk/awk.d.ts +2 -0
- package/dist/commands/awk/executor.d.ts +3 -0
- package/dist/commands/awk/expressions.d.ts +3 -0
- package/dist/commands/awk/functions.d.ts +12 -0
- package/dist/commands/awk/parser.d.ts +3 -0
- package/dist/commands/awk/types.d.ts +44 -0
- package/dist/commands/base64/base64.d.ts +5 -0
- package/dist/commands/basename/basename.d.ts +2 -0
- package/dist/commands/bash/bash.d.ts +3 -0
- package/dist/commands/cat/cat.d.ts +2 -0
- package/dist/commands/chmod/chmod.d.ts +2 -0
- package/dist/commands/clear/clear.d.ts +2 -0
- package/dist/commands/cp/cp.d.ts +2 -0
- package/dist/commands/curl/curl.d.ts +8 -0
- package/dist/commands/curl/form.d.ts +21 -0
- package/dist/commands/curl/help.d.ts +9 -0
- package/dist/commands/curl/parse.d.ts +9 -0
- package/dist/commands/curl/types.d.ts +31 -0
- package/dist/commands/curl/utils.d.ts +20 -0
- package/dist/commands/cut/cut.d.ts +2 -0
- package/dist/commands/date/date.d.ts +5 -0
- package/dist/commands/diff/diff.d.ts +5 -0
- package/dist/commands/dirname/dirname.d.ts +2 -0
- package/dist/commands/du/du.d.ts +2 -0
- package/dist/commands/echo/echo.d.ts +2 -0
- package/dist/commands/env/env.d.ts +3 -0
- package/dist/commands/expr/expr.d.ts +7 -0
- package/dist/commands/find/find.d.ts +2 -0
- package/dist/commands/find/matcher.d.ts +3 -0
- package/dist/commands/find/parser.d.ts +2 -0
- package/dist/commands/find/types.d.ts +70 -0
- package/dist/commands/grep/grep.d.ts +4 -0
- package/dist/commands/head/head-tail-shared.d.ts +38 -0
- package/dist/commands/head/head.d.ts +2 -0
- package/dist/commands/help/help.d.ts +2 -0
- package/dist/commands/help.d.ts +16 -0
- package/dist/commands/history/history.d.ts +2 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +7 -0
- package/dist/commands/jq/jq.d.ts +14 -0
- package/dist/commands/ln/ln.d.ts +2 -0
- package/dist/commands/ls/ls.d.ts +2 -0
- package/dist/commands/mkdir/mkdir.d.ts +2 -0
- package/dist/commands/mv/mv.d.ts +2 -0
- package/dist/commands/paste/paste.d.ts +2 -0
- package/dist/commands/printf/printf.d.ts +2 -0
- package/dist/commands/pwd/pwd.d.ts +2 -0
- package/dist/commands/readlink/readlink.d.ts +2 -0
- package/dist/commands/registry.d.ts +33 -0
- package/dist/commands/rm/rm.d.ts +2 -0
- package/dist/commands/sed/executor.d.ts +7 -0
- package/dist/commands/sed/parser.d.ts +5 -0
- package/dist/commands/sed/sed.d.ts +2 -0
- package/dist/commands/sed/types.d.ts +141 -0
- package/dist/commands/seq/seq.d.ts +14 -0
- package/dist/commands/sleep/sleep.d.ts +2 -0
- package/dist/commands/sort/comparator.d.ts +9 -0
- package/dist/commands/sort/parser.d.ts +11 -0
- package/dist/commands/sort/sort.d.ts +2 -0
- package/dist/commands/sort/types.d.ts +18 -0
- package/dist/commands/stat/stat.d.ts +2 -0
- package/dist/commands/tail/tail.d.ts +2 -0
- package/dist/commands/tee/tee.d.ts +2 -0
- package/dist/commands/timeout/timeout.d.ts +2 -0
- package/dist/commands/touch/touch.d.ts +2 -0
- package/dist/commands/tr/tr.d.ts +2 -0
- package/dist/commands/tree/tree.d.ts +2 -0
- package/dist/commands/true/true.d.ts +3 -0
- package/dist/commands/uniq/uniq.d.ts +2 -0
- package/dist/commands/wc/wc.d.ts +2 -0
- package/dist/commands/which/which.d.ts +2 -0
- package/dist/commands/xargs/xargs.d.ts +2 -0
- package/dist/fs-interface.d.ts +186 -0
- package/dist/fs.d.ts +39 -0
- package/dist/index.d.ts +12 -0
- package/dist/interpreter/arithmetic.d.ts +29 -0
- package/dist/interpreter/builtins/break.d.ts +6 -0
- package/dist/interpreter/builtins/cd.d.ts +6 -0
- package/dist/interpreter/builtins/continue.d.ts +6 -0
- package/dist/interpreter/builtins/declare.d.ts +29 -0
- package/dist/interpreter/builtins/eval.d.ts +9 -0
- package/dist/interpreter/builtins/exit.d.ts +5 -0
- package/dist/interpreter/builtins/export.d.ts +13 -0
- package/dist/interpreter/builtins/index.d.ts +36 -0
- package/dist/interpreter/builtins/let.d.ts +18 -0
- package/dist/interpreter/builtins/local.d.ts +6 -0
- package/dist/interpreter/builtins/read.d.ts +6 -0
- package/dist/interpreter/builtins/return.d.ts +6 -0
- package/dist/interpreter/builtins/set.d.ts +6 -0
- package/dist/interpreter/builtins/shift.d.ts +12 -0
- package/dist/interpreter/builtins/source.d.ts +6 -0
- package/dist/interpreter/builtins/unset.d.ts +12 -0
- package/dist/interpreter/builtins/variable-helpers.d.ts +30 -0
- package/dist/interpreter/conditionals.d.ts +17 -0
- package/dist/interpreter/control-flow.d.ts +21 -0
- package/dist/interpreter/errors.d.ts +107 -0
- package/dist/interpreter/expansion/analysis.d.ts +39 -0
- package/dist/interpreter/expansion/brace-range.d.ts +20 -0
- package/dist/interpreter/expansion/pattern.d.ts +22 -0
- package/dist/interpreter/expansion/variable.d.ts +27 -0
- package/dist/interpreter/expansion/word-split.d.ts +24 -0
- package/dist/interpreter/expansion.d.ts +27 -0
- package/dist/interpreter/functions.d.ts +12 -0
- package/dist/interpreter/helpers/array.d.ts +23 -0
- package/dist/interpreter/helpers/condition.d.ts +22 -0
- package/dist/interpreter/helpers/errors.d.ts +8 -0
- package/dist/interpreter/helpers/file-tests.d.ts +33 -0
- package/dist/interpreter/helpers/ifs.d.ts +43 -0
- package/dist/interpreter/helpers/loop.d.ts +24 -0
- package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
- package/dist/interpreter/helpers/readonly.d.ts +21 -0
- package/dist/interpreter/helpers/regex.d.ts +8 -0
- package/dist/interpreter/helpers/result.d.ts +54 -0
- package/dist/interpreter/helpers/statements.d.ts +20 -0
- package/dist/interpreter/helpers/string-compare.d.ts +22 -0
- package/dist/interpreter/helpers/string-tests.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
- package/dist/interpreter/helpers/word-parts.d.ts +22 -0
- package/dist/interpreter/index.d.ts +3 -0
- package/dist/interpreter/interpreter.d.ts +61 -0
- package/dist/interpreter/redirections.d.ts +14 -0
- package/dist/interpreter/types.d.ts +68 -0
- package/dist/limits.d.ts +26 -0
- package/dist/network/allow-list/shared.d.ts +45 -0
- package/dist/network/allow-list.d.ts +51 -0
- package/dist/network/fetch.d.ts +25 -0
- package/dist/network/index.d.ts +7 -0
- package/dist/network/types.d.ts +85 -0
- package/dist/overlay-fs/OverlayFs.d.ts +87 -0
- package/dist/overlay-fs/index.d.ts +1 -0
- package/dist/parser/arithmetic-parser.d.ts +25 -0
- package/dist/parser/command-parser.d.ts +10 -0
- package/dist/parser/compound-parser.d.ts +14 -0
- package/dist/parser/conditional-parser.d.ts +8 -0
- package/dist/parser/expansion-parser.d.ts +10 -0
- package/dist/parser/lexer.d.ts +135 -0
- package/dist/parser/parser.d.ts +92 -0
- package/dist/parser/types.d.ts +23 -0
- package/dist/parser/word-parser.d.ts +33 -0
- package/dist/sandbox/Command.d.ts +28 -0
- package/dist/sandbox/Sandbox.d.ts +60 -0
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/types.d.ts +80 -0
- package/dist/utils/args.d.ts +55 -0
- package/dist/utils/file-reader.d.ts +64 -0
- package/dist/utils/glob.d.ts +25 -0
- package/package.json +103 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface AwkContext {
|
|
2
|
+
FS: string;
|
|
3
|
+
OFS: string;
|
|
4
|
+
NR: number;
|
|
5
|
+
NF: number;
|
|
6
|
+
FNR: number;
|
|
7
|
+
FILENAME: string;
|
|
8
|
+
RSTART: number;
|
|
9
|
+
RLENGTH: number;
|
|
10
|
+
fields: string[];
|
|
11
|
+
line: string;
|
|
12
|
+
vars: Record<string, string | number>;
|
|
13
|
+
arrays: Record<string, Record<string, string | number>>;
|
|
14
|
+
functions: Record<string, AwkFunction>;
|
|
15
|
+
random?: () => number;
|
|
16
|
+
lines?: string[];
|
|
17
|
+
lineIndex?: number;
|
|
18
|
+
fieldSep?: RegExp;
|
|
19
|
+
maxIterations?: number;
|
|
20
|
+
exitCode?: number;
|
|
21
|
+
shouldExit?: boolean;
|
|
22
|
+
shouldNext?: boolean;
|
|
23
|
+
loopBreak?: boolean;
|
|
24
|
+
loopContinue?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface AwkFunction {
|
|
27
|
+
params: string[];
|
|
28
|
+
body: string;
|
|
29
|
+
}
|
|
30
|
+
export interface PatternRange {
|
|
31
|
+
start: string;
|
|
32
|
+
end: string;
|
|
33
|
+
}
|
|
34
|
+
export interface AwkRule {
|
|
35
|
+
pattern: string | null;
|
|
36
|
+
range?: PatternRange;
|
|
37
|
+
action: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ParsedProgram {
|
|
40
|
+
begin: string | null;
|
|
41
|
+
main: AwkRule[];
|
|
42
|
+
end: string | null;
|
|
43
|
+
functions: Record<string, AwkFunction>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* curl - Transfer data from or to a server
|
|
3
|
+
*
|
|
4
|
+
* This is a simplified implementation of curl that uses the secure fetch wrapper.
|
|
5
|
+
* Network access must be explicitly configured via BashEnvOptions.network.
|
|
6
|
+
*/
|
|
7
|
+
import type { Command } from "../../types.js";
|
|
8
|
+
export declare const curlCommand: Command;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form data handling for curl command
|
|
3
|
+
*/
|
|
4
|
+
import type { FormField } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* URL-encode form data in curl's --data-urlencode format
|
|
7
|
+
* Supports: name=content, =content, name@file, @file
|
|
8
|
+
*/
|
|
9
|
+
export declare function encodeFormData(input: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Parse -F/--form field specification
|
|
12
|
+
* Supports: name=value, name=@file, name=<file, name=value;type=mime
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseFormField(spec: string): FormField | null;
|
|
15
|
+
/**
|
|
16
|
+
* Generate multipart form data body and boundary
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateMultipartBody(fields: FormField[], fileContents: Map<string, string>): {
|
|
19
|
+
body: string;
|
|
20
|
+
boundary: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Option parsing for curl command
|
|
3
|
+
*/
|
|
4
|
+
import type { ExecResult } from "../../types.js";
|
|
5
|
+
import type { CurlOptions } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Parse curl command line arguments
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseOptions(args: string[]): CurlOptions | ExecResult;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for curl command
|
|
3
|
+
*/
|
|
4
|
+
export interface FormField {
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
filename?: string;
|
|
8
|
+
contentType?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CurlOptions {
|
|
11
|
+
method: string;
|
|
12
|
+
headers: Record<string, string>;
|
|
13
|
+
data?: string;
|
|
14
|
+
dataBinary: boolean;
|
|
15
|
+
formFields: FormField[];
|
|
16
|
+
user?: string;
|
|
17
|
+
uploadFile?: string;
|
|
18
|
+
cookieJar?: string;
|
|
19
|
+
outputFile?: string;
|
|
20
|
+
useRemoteName: boolean;
|
|
21
|
+
headOnly: boolean;
|
|
22
|
+
includeHeaders: boolean;
|
|
23
|
+
silent: boolean;
|
|
24
|
+
showError: boolean;
|
|
25
|
+
failSilently: boolean;
|
|
26
|
+
followRedirects: boolean;
|
|
27
|
+
writeOut?: string;
|
|
28
|
+
verbose: boolean;
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
url?: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for curl command
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Format response headers for output
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatHeaders(headers: Record<string, string>): string;
|
|
8
|
+
/**
|
|
9
|
+
* Extract filename from URL for -O option
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractFilename(url: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Apply write-out format string replacements
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyWriteOut(format: string, result: {
|
|
16
|
+
status: number;
|
|
17
|
+
headers: Record<string, string>;
|
|
18
|
+
url: string;
|
|
19
|
+
bodyLength: number;
|
|
20
|
+
}): string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export type Expression = {
|
|
2
|
+
type: "name";
|
|
3
|
+
pattern: string;
|
|
4
|
+
ignoreCase?: boolean;
|
|
5
|
+
} | {
|
|
6
|
+
type: "path";
|
|
7
|
+
pattern: string;
|
|
8
|
+
ignoreCase?: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
type: "type";
|
|
11
|
+
fileType: "f" | "d";
|
|
12
|
+
} | {
|
|
13
|
+
type: "empty";
|
|
14
|
+
} | {
|
|
15
|
+
type: "mtime";
|
|
16
|
+
days: number;
|
|
17
|
+
comparison: "exact" | "more" | "less";
|
|
18
|
+
} | {
|
|
19
|
+
type: "newer";
|
|
20
|
+
refPath: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: "size";
|
|
23
|
+
value: number;
|
|
24
|
+
unit: SizeUnit;
|
|
25
|
+
comparison: "exact" | "more" | "less";
|
|
26
|
+
} | {
|
|
27
|
+
type: "perm";
|
|
28
|
+
mode: number;
|
|
29
|
+
matchType: "exact" | "all" | "any";
|
|
30
|
+
} | {
|
|
31
|
+
type: "not";
|
|
32
|
+
expr: Expression;
|
|
33
|
+
} | {
|
|
34
|
+
type: "and";
|
|
35
|
+
left: Expression;
|
|
36
|
+
right: Expression;
|
|
37
|
+
} | {
|
|
38
|
+
type: "or";
|
|
39
|
+
left: Expression;
|
|
40
|
+
right: Expression;
|
|
41
|
+
};
|
|
42
|
+
export type SizeUnit = "c" | "k" | "M" | "G" | "b";
|
|
43
|
+
export type FindAction = {
|
|
44
|
+
type: "exec";
|
|
45
|
+
command: string[];
|
|
46
|
+
batchMode: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
type: "print";
|
|
49
|
+
} | {
|
|
50
|
+
type: "print0";
|
|
51
|
+
} | {
|
|
52
|
+
type: "delete";
|
|
53
|
+
};
|
|
54
|
+
export interface EvalContext {
|
|
55
|
+
name: string;
|
|
56
|
+
relativePath: string;
|
|
57
|
+
isFile: boolean;
|
|
58
|
+
isDirectory: boolean;
|
|
59
|
+
isEmpty: boolean;
|
|
60
|
+
mtime: number;
|
|
61
|
+
size: number;
|
|
62
|
+
mode: number;
|
|
63
|
+
newerRefTimes: Map<string, number>;
|
|
64
|
+
}
|
|
65
|
+
export interface ParseResult {
|
|
66
|
+
expr: Expression | null;
|
|
67
|
+
pathIndex: number;
|
|
68
|
+
error?: string;
|
|
69
|
+
actions: FindAction[];
|
|
70
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for head and tail commands.
|
|
3
|
+
*/
|
|
4
|
+
import type { CommandContext, ExecResult } from "../../types.js";
|
|
5
|
+
export interface HeadTailOptions {
|
|
6
|
+
lines: number;
|
|
7
|
+
bytes: number | null;
|
|
8
|
+
quiet: boolean;
|
|
9
|
+
verbose: boolean;
|
|
10
|
+
files: string[];
|
|
11
|
+
/** tail-specific: start from line N instead of last N lines */
|
|
12
|
+
fromLine?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type HeadTailParseResult = {
|
|
15
|
+
ok: true;
|
|
16
|
+
options: HeadTailOptions;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
error: ExecResult;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Parse head/tail command arguments.
|
|
23
|
+
* Both commands share most options, with tail having additional +N syntax.
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseHeadTailArgs(args: string[], cmdName: "head" | "tail"): HeadTailParseResult;
|
|
26
|
+
/**
|
|
27
|
+
* Process files for head/tail commands.
|
|
28
|
+
* Handles stdin, multiple files, headers, and error handling.
|
|
29
|
+
*/
|
|
30
|
+
export declare function processHeadTailFiles(ctx: CommandContext, options: HeadTailOptions, cmdName: "head" | "tail", contentProcessor: (content: string) => string): Promise<ExecResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Get the first N lines or bytes from content.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getHead(content: string, lines: number, bytes: number | null): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get the last N lines or bytes from content.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getTail(content: string, lines: number, bytes: number | null, fromLine: boolean): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ExecResult } from "../types.js";
|
|
2
|
+
export interface HelpInfo {
|
|
3
|
+
name: string;
|
|
4
|
+
summary: string;
|
|
5
|
+
usage: string;
|
|
6
|
+
description?: string | string[];
|
|
7
|
+
options?: string[];
|
|
8
|
+
examples?: string[];
|
|
9
|
+
notes?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function showHelp(info: HelpInfo): ExecResult;
|
|
12
|
+
export declare function hasHelpFlag(args: string[]): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Returns an error result for an unknown option
|
|
15
|
+
*/
|
|
16
|
+
export declare function unknownOption(cmdName: string, option: string): ExecResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jq - Command-line JSON processor
|
|
3
|
+
*
|
|
4
|
+
* Supports a subset of jq syntax:
|
|
5
|
+
* - . (identity)
|
|
6
|
+
* - .key, .key.nested (object access)
|
|
7
|
+
* - .[0], .[-1] (array indexing)
|
|
8
|
+
* - .[] (array/object iteration)
|
|
9
|
+
* - .key[] (access then iterate)
|
|
10
|
+
* - keys, values, length, type
|
|
11
|
+
* - Pipes: .foo | .bar
|
|
12
|
+
*/
|
|
13
|
+
import type { Command } from "../../types.js";
|
|
14
|
+
export declare const jqCommand: Command;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Command } from "../types.js";
|
|
2
|
+
/** All available built-in command names (excludes network commands like curl) */
|
|
3
|
+
export type CommandName = "echo" | "cat" | "printf" | "ls" | "mkdir" | "touch" | "rm" | "cp" | "mv" | "ln" | "chmod" | "pwd" | "readlink" | "head" | "tail" | "wc" | "stat" | "grep" | "fgrep" | "egrep" | "sed" | "awk" | "sort" | "uniq" | "cut" | "paste" | "tr" | "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" | "html-to-markdown" | "help" | "which";
|
|
4
|
+
/** Network command names (only available when network is configured) */
|
|
5
|
+
export type NetworkCommandName = "curl";
|
|
6
|
+
/** All command names including network commands */
|
|
7
|
+
export type AllCommandName = CommandName | NetworkCommandName;
|
|
8
|
+
/**
|
|
9
|
+
* Gets all available command names (excludes network commands)
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCommandNames(): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Gets all network command names
|
|
14
|
+
*/
|
|
15
|
+
export declare function getNetworkCommandNames(): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Creates all lazy commands for registration (excludes network commands)
|
|
18
|
+
* @param filter Optional array of command names to include. If not provided, all commands are created.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createLazyCommands(filter?: CommandName[]): Command[];
|
|
21
|
+
/**
|
|
22
|
+
* Creates network commands for registration (curl, etc.)
|
|
23
|
+
* These are only registered when network is explicitly configured.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createNetworkCommands(): Command[];
|
|
26
|
+
/**
|
|
27
|
+
* Clears the command cache (for testing)
|
|
28
|
+
*/
|
|
29
|
+
export declare function clearCommandCache(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the number of loaded commands (for testing)
|
|
32
|
+
*/
|
|
33
|
+
export declare function getLoadedCommandCount(): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SedCommand, SedExecutionLimits, SedState } from "./types.js";
|
|
2
|
+
export declare function createInitialState(totalLines: number): SedState;
|
|
3
|
+
export interface ExecuteContext {
|
|
4
|
+
lines: string[];
|
|
5
|
+
currentLineIndex: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function executeCommands(commands: SedCommand[], state: SedState, ctx?: ExecuteContext, limits?: SedExecutionLimits): number;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export interface StepAddress {
|
|
2
|
+
first: number;
|
|
3
|
+
step: number;
|
|
4
|
+
}
|
|
5
|
+
export type SedAddress = number | "$" | {
|
|
6
|
+
pattern: string;
|
|
7
|
+
} | StepAddress;
|
|
8
|
+
export interface AddressRange {
|
|
9
|
+
start?: SedAddress;
|
|
10
|
+
end?: SedAddress;
|
|
11
|
+
}
|
|
12
|
+
export type SedCommandType = "substitute" | "print" | "printFirstLine" | "delete" | "deleteFirstLine" | "append" | "insert" | "change" | "hold" | "holdAppend" | "get" | "getAppend" | "exchange" | "next" | "nextAppend" | "quit" | "transliterate" | "lineNumber" | "branch" | "branchOnSubst" | "branchOnNoSubst" | "label" | "zap" | "group";
|
|
13
|
+
export interface SubstituteCommand {
|
|
14
|
+
type: "substitute";
|
|
15
|
+
address?: AddressRange;
|
|
16
|
+
pattern: string;
|
|
17
|
+
replacement: string;
|
|
18
|
+
global: boolean;
|
|
19
|
+
ignoreCase: boolean;
|
|
20
|
+
printOnMatch: boolean;
|
|
21
|
+
nthOccurrence?: number;
|
|
22
|
+
extendedRegex?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface PrintCommand {
|
|
25
|
+
type: "print";
|
|
26
|
+
address?: AddressRange;
|
|
27
|
+
}
|
|
28
|
+
export interface DeleteCommand {
|
|
29
|
+
type: "delete";
|
|
30
|
+
address?: AddressRange;
|
|
31
|
+
}
|
|
32
|
+
export interface AppendCommand {
|
|
33
|
+
type: "append";
|
|
34
|
+
address?: AddressRange;
|
|
35
|
+
text: string;
|
|
36
|
+
}
|
|
37
|
+
export interface InsertCommand {
|
|
38
|
+
type: "insert";
|
|
39
|
+
address?: AddressRange;
|
|
40
|
+
text: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ChangeCommand {
|
|
43
|
+
type: "change";
|
|
44
|
+
address?: AddressRange;
|
|
45
|
+
text: string;
|
|
46
|
+
}
|
|
47
|
+
export interface HoldCommand {
|
|
48
|
+
type: "hold";
|
|
49
|
+
address?: AddressRange;
|
|
50
|
+
}
|
|
51
|
+
export interface HoldAppendCommand {
|
|
52
|
+
type: "holdAppend";
|
|
53
|
+
address?: AddressRange;
|
|
54
|
+
}
|
|
55
|
+
export interface GetCommand {
|
|
56
|
+
type: "get";
|
|
57
|
+
address?: AddressRange;
|
|
58
|
+
}
|
|
59
|
+
export interface GetAppendCommand {
|
|
60
|
+
type: "getAppend";
|
|
61
|
+
address?: AddressRange;
|
|
62
|
+
}
|
|
63
|
+
export interface ExchangeCommand {
|
|
64
|
+
type: "exchange";
|
|
65
|
+
address?: AddressRange;
|
|
66
|
+
}
|
|
67
|
+
export interface NextCommand {
|
|
68
|
+
type: "next";
|
|
69
|
+
address?: AddressRange;
|
|
70
|
+
}
|
|
71
|
+
export interface QuitCommand {
|
|
72
|
+
type: "quit";
|
|
73
|
+
address?: AddressRange;
|
|
74
|
+
}
|
|
75
|
+
export interface NextAppendCommand {
|
|
76
|
+
type: "nextAppend";
|
|
77
|
+
address?: AddressRange;
|
|
78
|
+
}
|
|
79
|
+
export interface TransliterateCommand {
|
|
80
|
+
type: "transliterate";
|
|
81
|
+
address?: AddressRange;
|
|
82
|
+
source: string;
|
|
83
|
+
dest: string;
|
|
84
|
+
}
|
|
85
|
+
export interface LineNumberCommand {
|
|
86
|
+
type: "lineNumber";
|
|
87
|
+
address?: AddressRange;
|
|
88
|
+
}
|
|
89
|
+
export interface BranchCommand {
|
|
90
|
+
type: "branch";
|
|
91
|
+
address?: AddressRange;
|
|
92
|
+
label?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface BranchOnSubstCommand {
|
|
95
|
+
type: "branchOnSubst";
|
|
96
|
+
address?: AddressRange;
|
|
97
|
+
label?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface LabelCommand {
|
|
100
|
+
type: "label";
|
|
101
|
+
name: string;
|
|
102
|
+
}
|
|
103
|
+
export interface BranchOnNoSubstCommand {
|
|
104
|
+
type: "branchOnNoSubst";
|
|
105
|
+
address?: AddressRange;
|
|
106
|
+
label?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface PrintFirstLineCommand {
|
|
109
|
+
type: "printFirstLine";
|
|
110
|
+
address?: AddressRange;
|
|
111
|
+
}
|
|
112
|
+
export interface DeleteFirstLineCommand {
|
|
113
|
+
type: "deleteFirstLine";
|
|
114
|
+
address?: AddressRange;
|
|
115
|
+
}
|
|
116
|
+
export interface ZapCommand {
|
|
117
|
+
type: "zap";
|
|
118
|
+
address?: AddressRange;
|
|
119
|
+
}
|
|
120
|
+
export interface GroupCommand {
|
|
121
|
+
type: "group";
|
|
122
|
+
address?: AddressRange;
|
|
123
|
+
commands: SedCommand[];
|
|
124
|
+
}
|
|
125
|
+
export type SedCommand = SubstituteCommand | PrintCommand | PrintFirstLineCommand | DeleteCommand | DeleteFirstLineCommand | AppendCommand | InsertCommand | ChangeCommand | HoldCommand | HoldAppendCommand | GetCommand | GetAppendCommand | ExchangeCommand | NextCommand | QuitCommand | NextAppendCommand | TransliterateCommand | LineNumberCommand | BranchCommand | BranchOnSubstCommand | BranchOnNoSubstCommand | LabelCommand | ZapCommand | GroupCommand;
|
|
126
|
+
export interface SedState {
|
|
127
|
+
patternSpace: string;
|
|
128
|
+
holdSpace: string;
|
|
129
|
+
lineNumber: number;
|
|
130
|
+
totalLines: number;
|
|
131
|
+
deleted: boolean;
|
|
132
|
+
printed: boolean;
|
|
133
|
+
quit: boolean;
|
|
134
|
+
appendBuffer: string[];
|
|
135
|
+
substitutionMade: boolean;
|
|
136
|
+
lineNumberOutput: string[];
|
|
137
|
+
restartCycle: boolean;
|
|
138
|
+
}
|
|
139
|
+
export interface SedExecutionLimits {
|
|
140
|
+
maxIterations: number;
|
|
141
|
+
}
|