@poe-platform/safe-bash 0.1.788 → 0.1.790
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/README.md +1 -1
- package/dist/image-ast/index.browser.js +147 -80
- package/dist/image-ast/index.js +147 -80
- package/dist/mp4-ast/mp4.d.ts +2 -0
- package/dist/pdf-ast/cos/parser.d.ts +1 -0
- package/dist/pdf-ast/cos/security.d.ts +2 -0
- package/dist/pdf-ast/cos/writer.d.ts +1 -0
- package/dist/pdf-ast/document.d.ts +3 -0
- package/dist/pdf-ast/edit/forms.d.ts +1 -0
- package/dist/pdf-ast/index.js +171 -82
- package/dist/safe-bash/chunks/{chunk-L5QQLNTO.js → chunk-22PI65AH.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-2TAGYMPK.js} +49 -34
- package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-2W4HTMEK.js} +52 -48
- package/dist/safe-bash/chunks/{chunk-FFZXP6ZC.js → chunk-3M7L7XU2.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-XNODZRVD.js → chunk-3QAO6UYS.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-YPETOVQU.js → chunk-3VKFK3NF.js} +2 -2
- package/dist/safe-bash/chunks/chunk-5OST7NOX.js +42 -0
- package/dist/safe-bash/chunks/{chunk-KEBSX2AX.js → chunk-6HLURHVU.js} +2 -2
- package/dist/safe-bash/chunks/chunk-DYEUZE6Z.js +19 -0
- package/dist/safe-bash/chunks/{chunk-T2TGCHKE.js → chunk-FM3WBSZT.js} +2 -2
- package/dist/safe-bash/chunks/chunk-GAYRKQM6.js +22 -0
- package/dist/safe-bash/chunks/{chunk-Q45QCA4J.js → chunk-I3KSESCR.js} +0 -7
- package/dist/safe-bash/chunks/{chunk-OSKDIBQS.js → chunk-JLIMK5TD.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-2AYZCT5X.js → chunk-JQ2FAJJT.js} +27 -23
- package/dist/safe-bash/chunks/{chunk-QA3NVP43.js → chunk-JRE6Z3T7.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-DC5EHLKS.js → chunk-NDIL6T7Y.js} +5 -5
- package/dist/safe-bash/chunks/{chunk-747G42FY.js → chunk-OPR4UAIT.js} +2 -2
- package/dist/safe-bash/chunks/chunk-OSMQCYSP.js +19 -0
- package/dist/safe-bash/chunks/chunk-OYB332PQ.js +17 -0
- package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-QTIH2AFE.js} +77 -69
- package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-SBESXWT2.js} +43 -44
- package/dist/safe-bash/chunks/{chunk-4FDQJUFW.js → chunk-SDEPGTOF.js} +1 -1
- package/dist/safe-bash/chunks/chunk-UZU5BIJI.js +32 -0
- package/dist/safe-bash/chunks/{chunk-BI6JV62X.js → chunk-VCCMROTL.js} +7 -10
- package/dist/safe-bash/chunks/chunk-W47GHRRF.js +13 -0
- package/dist/safe-bash/chunks/{chunk-NPMQWZUZ.js → chunk-WS7KZIUM.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-3PZYHMGM.js → chunk-YYAERCWS.js} +7 -7
- package/dist/safe-bash/chunks/{chunk-5U7JECDB.js → chunk-ZPGVEUKF.js} +8 -7
- package/dist/safe-bash/chunks/{csvkit-K55OYAQC.js → csvkit-USUJG62I.js} +65 -11
- package/dist/safe-bash/chunks/{ffmpeg-BEFTQ6DZ.js → ffmpeg-KRGG5DLH.js} +21 -10
- package/dist/safe-bash/chunks/{gh-HQWOWLWE.js → gh-UCFDUZCX.js} +16 -8
- package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-LPAF6KDG.js} +7 -9
- package/dist/safe-bash/chunks/{imagemagick-53BMHH6D.js → imagemagick-KGREKK4G.js} +38 -7
- package/dist/safe-bash/chunks/{implementation-QUTAAYMT.js → implementation-FXDRYS5A.js} +34 -8
- package/dist/safe-bash/chunks/{pdfimages-4OYI6FLG.js → pdfimages-UADCF4G4.js} +12 -8
- package/dist/safe-bash/chunks/{pdfinfo-I7U6TQPP.js → pdfinfo-O7UWPF4W.js} +38 -13
- package/dist/safe-bash/chunks/{pdftk-SUA6FMHI.js → pdftk-AERXIJTN.js} +13 -8
- package/dist/safe-bash/chunks/{pdftoppm-4C5DGEWX.js → pdftoppm-L466JQKI.js} +17 -10
- package/dist/safe-bash/chunks/{pdftotext-Y4WI225Y.js → pdftotext-SUSI4WXS.js} +19 -9
- package/dist/safe-bash/chunks/{qpdf-IORB4RV5.js → qpdf-YL24KVRH.js} +14 -8
- package/dist/safe-bash/chunks/{sips-WHAMJFEU.js → sips-QXEQZERX.js} +14 -7
- package/dist/safe-bash/chunks/{soffice-SYEK6WJS.js → soffice-TBITRML3.js} +16 -8
- package/dist/safe-bash/chunks/{wkhtmltopdf-ZIICWJLF.js → wkhtmltopdf-NJA2THRC.js} +27 -7
- package/dist/safe-bash/command-chunks/chunk-2C5BEBPY.js +1388 -0
- package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2EXV2ZLV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PFBJR2PY.js → chunk-2KRKKW5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4DSJDVBM.js → chunk-32F3RBUW.js} +10 -749
- package/dist/safe-bash/command-chunks/{chunk-L3MLMXL4.js → chunk-3ZK5F23O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4QX6XCDD.js → chunk-4RNIZ3RT.js} +79 -0
- package/dist/safe-bash/command-chunks/{chunk-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
- package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-6EASC5EC.js} +20 -9
- package/dist/safe-bash/command-chunks/{chunk-ZF3ZVGQC.js → chunk-7JRITHKW.js} +150 -80
- package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
- package/dist/safe-bash/{chunks/chunk-LD76P7AG.js → command-chunks/chunk-AKDMCNX4.js} +74 -39
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-CBDVLMJB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XGMWWUHV.js → chunk-CZ5DAK4K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z57TV6TC.js → chunk-EZ2DTOLI.js} +4 -2
- package/dist/safe-bash/command-chunks/{chunk-ADCGH6A7.js → chunk-FH3D75FC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WYJTWJZ5.js → chunk-G3G6W5ZE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3HDIDEUJ.js → chunk-GF54KE2M.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-H4LWTITX.js +169 -0
- package/dist/safe-bash/command-chunks/chunk-I2MQNBGR.js +145 -0
- package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-5GRLAARV.js → chunk-IOXI5ZAJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-MDPIOQUD.js} +12 -8
- package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-QI4MGIN6.js +6 -0
- package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
- package/dist/safe-bash/command-chunks/chunk-QTYZAWSB.js +91 -0
- package/dist/safe-bash/command-chunks/chunk-SNK7K3XW.js +90 -0
- package/dist/safe-bash/command-chunks/chunk-T5OLGM43.js +314 -0
- package/dist/safe-bash/command-chunks/chunk-TB7IFMUZ.js +802 -0
- package/dist/safe-bash/command-chunks/{chunk-YNT4ZJHW.js → chunk-TPPBPIWL.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-VMK4XVKO.js +82 -0
- package/dist/safe-bash/command-chunks/chunk-VNSJKXDU.js +130 -0
- package/dist/safe-bash/command-chunks/{chunk-2LP3VMPA.js → chunk-WFDW4XXD.js} +1 -17
- package/dist/safe-bash/command-chunks/chunk-WR37IS4O.js +318 -0
- package/dist/safe-bash/command-chunks/chunk-YFNTMH6Z.js +6 -0
- package/dist/safe-bash/commands/basic.js +148 -48
- package/dist/safe-bash/commands/bytes/compression/index.js +5 -6
- package/dist/safe-bash/commands/cmp.d.ts +2 -3
- package/dist/safe-bash/commands/cmp.js +2 -689
- package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
- package/dist/safe-bash/commands/docx/index.browser.js +4 -47
- package/dist/safe-bash/commands/docx/index.d.ts +2 -24
- package/dist/safe-bash/commands/docx/index.js +2 -41
- package/dist/safe-bash/commands/docx/io.d.ts +1 -14
- package/dist/safe-bash/commands/docx/io.js +1 -15
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
- package/dist/safe-bash/commands/llm/command.d.ts +1 -4
- package/dist/safe-bash/commands/llm/command.js +1 -248
- package/dist/safe-bash/commands/llm/elevenlabs-stream.d.ts +1 -2
- package/dist/safe-bash/commands/llm/elevenlabs-stream.js +1 -117
- package/dist/safe-bash/commands/llm/elevenlabs.d.ts +1 -15
- package/dist/safe-bash/commands/llm/elevenlabs.js +1 -123
- package/dist/safe-bash/commands/llm/index.browser.js +20 -15
- package/dist/safe-bash/commands/llm/index.d.ts +1 -6
- package/dist/safe-bash/commands/llm/index.js +1 -4
- package/dist/safe-bash/commands/llm/mime.d.ts +1 -2
- package/dist/safe-bash/commands/llm/mime.js +1 -136
- package/dist/safe-bash/commands/llm/openai-http.d.ts +1 -8
- package/dist/safe-bash/commands/llm/openai-http.js +1 -143
- package/dist/safe-bash/commands/llm/openai-sse.d.ts +1 -3
- package/dist/safe-bash/commands/llm/openai-sse.js +1 -78
- package/dist/safe-bash/commands/llm/openai.d.ts +1 -14
- package/dist/safe-bash/commands/llm/openai.js +1 -288
- package/dist/safe-bash/commands/llm/providers/elevenlabs.d.ts +1 -1
- package/dist/safe-bash/commands/llm/providers/elevenlabs.js +1 -1
- package/dist/safe-bash/commands/llm/providers/index.browser.js +6 -6
- package/dist/safe-bash/commands/llm/providers/index.d.ts +1 -3
- package/dist/safe-bash/commands/llm/providers/index.js +1 -2
- package/dist/safe-bash/commands/llm/providers/openai.d.ts +1 -1
- package/dist/safe-bash/commands/llm/providers/openai.js +1 -1
- package/dist/safe-bash/commands/llm/providers/shared.d.ts +1 -23
- package/dist/safe-bash/commands/llm/providers/shared.js +1 -65
- package/dist/safe-bash/commands/llm/service.d.ts +1 -37
- package/dist/safe-bash/commands/llm/service.js +1 -151
- package/dist/safe-bash/commands/llm/types.d.ts +1 -52
- package/dist/safe-bash/commands/llm/types.js +1 -1
- package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
- package/dist/safe-bash/commands/media/index.browser.js +1 -1
- package/dist/safe-bash/commands/network/index.browser.js +9 -9
- package/dist/safe-bash/commands/network/types.d.ts +2 -40
- package/dist/safe-bash/commands/node/index.browser.js +6 -8
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/op/index.js +12 -28
- package/dist/safe-bash/commands/pptx/index.d.ts +2 -28
- package/dist/safe-bash/commands/pptx/index.js +2 -152
- package/dist/safe-bash/commands/pr/index.browser.js +2 -2
- package/dist/safe-bash/commands/printf-float.d.ts +1 -0
- package/dist/safe-bash/commands/printf-float.js +48 -38
- package/dist/safe-bash/commands/printf-format.js +9 -6
- package/dist/safe-bash/commands/printf-quote.d.ts +3 -0
- package/dist/safe-bash/commands/printf-quote.js +62 -0
- package/dist/safe-bash/commands/printf-wide.d.ts +5 -0
- package/dist/safe-bash/commands/printf-wide.js +41 -0
- package/dist/safe-bash/commands/python/index.browser.js +8 -8
- package/dist/safe-bash/commands/python/worker.browser.js +2 -2
- package/dist/safe-bash/commands/truncate.d.ts +2 -3
- package/dist/safe-bash/commands/truncate.js +2 -686
- package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
- package/dist/safe-bash/commands/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +3 -3
- package/dist/safe-bash/contracts/diagnostics.d.ts +2 -0
- package/dist/safe-bash/contracts/diagnostics.js +2 -0
- package/dist/safe-bash/contracts/runtime-control.d.ts +2 -0
- package/dist/safe-bash/contracts/runtime-control.js +2 -0
- package/dist/safe-bash/core.browser.d.ts +1 -1
- package/dist/safe-bash/core.browser.js +10645 -14065
- package/dist/safe-bash/core.d.ts +10 -1
- package/dist/safe-bash/core.js +0 -1
- package/dist/safe-bash/jobs.browser.js +5 -4
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -2
- package/dist/safe-bash/opt-in/commands/cmp/index.js +776 -79
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +0 -12
- package/dist/safe-bash/opt-in/commands/cmp/options.js +0 -153
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +8 -3
- package/dist/safe-bash/opt-in/commands/truncate/index.js +790 -272
- package/dist/safe-bash/opt-in/commands/truncate/sync.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/truncate/sync.js +60 -0
- package/dist/safe-bash/optional-host.browser.js +61 -80
- package/dist/safe-bash/optional-host.d.ts +3 -1
- package/dist/safe-bash/optional-host.js +3 -1
- package/dist/safe-bash/shell/runtime.js +44 -18
- package/dist/safe-bash/yq-browser/index.js +1 -1
- package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
- package/dist/safe-bash-checksum-engine/index.js +14 -2
- package/dist/safe-bash-command-bzip2/index.js +2 -1
- package/dist/safe-bash-command-cmp/index.d.ts +10 -0
- package/dist/safe-bash-command-cmp/index.js +796 -0
- package/dist/safe-bash-command-cmp/options.d.ts +12 -0
- package/dist/safe-bash-command-cmp/options.js +42 -0
- package/dist/safe-bash-command-csvcut/index.js +11 -8
- package/dist/safe-bash-command-csvgrep/index.js +35 -7
- package/dist/safe-bash-command-csvkit/codecs/python.js +4 -3
- package/dist/safe-bash-command-csvkit/codecs/utf8.js +3 -2
- package/dist/safe-bash-command-csvkit/index.js +80 -324
- package/dist/safe-bash-command-csvkit/python-regex.d.ts +5 -0
- package/dist/safe-bash-command-csvkit/python-regex.js +14 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +4 -2
- package/dist/safe-bash-command-diff3/index.js +3 -0
- package/dist/safe-bash-command-docx/LICENSE +21 -0
- package/dist/safe-bash-command-docx/index.d.ts +30 -0
- package/dist/safe-bash-command-docx/index.js +67 -0
- package/dist/safe-bash-command-docx/io.d.ts +14 -0
- package/dist/safe-bash-command-docx/io.js +26 -0
- package/dist/safe-bash-command-envsubst/index.js +34 -3
- package/dist/safe-bash-command-exiftool/index.js +3 -0
- package/dist/safe-bash-command-ffmpeg/index.js +8073 -7940
- package/dist/safe-bash-command-fold/family.js +1 -1
- package/dist/safe-bash-command-fold/index.js +1 -1
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/wasm.generated.js +1 -1
- package/dist/safe-bash-command-htmlq/index.js +5 -0
- package/dist/safe-bash-command-imagemagick/index.d.ts +25 -21
- package/dist/safe-bash-command-imagemagick/index.js +671 -273
- package/dist/safe-bash-command-llm/LICENSE +21 -0
- package/dist/safe-bash-command-llm/command.d.ts +5 -0
- package/dist/safe-bash-command-llm/command.js +14 -0
- package/dist/safe-bash-command-llm/configuration.d.ts +18 -0
- package/dist/safe-bash-command-llm/elevenlabs-stream.d.ts +2 -0
- package/dist/safe-bash-command-llm/elevenlabs-stream.js +7 -0
- package/dist/safe-bash-command-llm/elevenlabs.d.ts +15 -0
- package/dist/safe-bash-command-llm/elevenlabs.js +10 -0
- package/dist/safe-bash-command-llm/index.d.ts +10 -0
- package/dist/safe-bash-command-llm/index.js +46 -0
- package/dist/safe-bash-command-llm/mime.d.ts +2 -0
- package/dist/safe-bash-command-llm/mime.js +9 -0
- package/dist/safe-bash-command-llm/model-options.d.ts +3 -0
- package/dist/safe-bash-command-llm/openai-http.d.ts +8 -0
- package/dist/safe-bash-command-llm/openai-http.js +17 -0
- package/dist/safe-bash-command-llm/openai-sse.d.ts +3 -0
- package/dist/safe-bash-command-llm/openai-sse.js +8 -0
- package/dist/safe-bash-command-llm/openai.d.ts +14 -0
- package/dist/safe-bash-command-llm/openai.js +12 -0
- package/dist/safe-bash-command-llm/providers/elevenlabs.d.ts +1 -0
- package/dist/safe-bash-command-llm/providers/elevenlabs.js +11 -0
- package/dist/safe-bash-command-llm/providers/index.d.ts +3 -0
- package/dist/safe-bash-command-llm/providers/index.js +24 -0
- package/dist/safe-bash-command-llm/providers/openai.d.ts +1 -0
- package/dist/safe-bash-command-llm/providers/openai.js +13 -0
- package/dist/safe-bash-command-llm/providers/shared.d.ts +23 -0
- package/dist/safe-bash-command-llm/providers/shared.js +13 -0
- package/dist/safe-bash-command-llm/schemas.d.ts +2 -0
- package/dist/safe-bash-command-llm/service.d.ts +42 -0
- package/dist/safe-bash-command-llm/service.js +9 -0
- package/dist/safe-bash-command-llm/templates.d.ts +27 -0
- package/dist/safe-bash-command-llm/types.d.ts +87 -0
- package/dist/safe-bash-command-llm/types.js +6 -0
- package/dist/safe-bash-command-mmdc/command.d.ts +4 -0
- package/dist/safe-bash-command-mmdc/index.d.ts +1 -1
- package/dist/safe-bash-command-mmdc/index.js +7134 -6699
- package/dist/safe-bash-command-mmdc/layout.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/parser.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/png.d.ts +3 -0
- package/dist/safe-bash-command-mmdc/raster.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/svg.d.ts +1 -0
- package/dist/safe-bash-command-op/index.js +19 -14
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
- package/dist/safe-bash-command-pdfimages/index.js +210 -113
- package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
- package/dist/safe-bash-command-pdfinfo/index.js +517 -241
- package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
- package/dist/safe-bash-command-pdftk/index.js +261 -125
- package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
- package/dist/safe-bash-command-pdftoppm/index.js +326 -189
- package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
- package/dist/safe-bash-command-pdftotext/index.js +237 -107
- package/dist/safe-bash-command-pptx/LICENSE +21 -0
- package/dist/safe-bash-command-pptx/index.d.ts +33 -0
- package/dist/safe-bash-command-pptx/index.js +168 -0
- package/dist/safe-bash-command-qpdf/index.d.ts +9 -3
- package/dist/safe-bash-command-qpdf/index.js +254 -130
- package/dist/safe-bash-command-sha512sum/index.js +12 -475
- package/dist/safe-bash-command-sips/index.d.ts +9 -5
- package/dist/safe-bash-command-sips/index.js +65 -46
- package/dist/safe-bash-command-soffice/index.d.ts +9 -3
- package/dist/safe-bash-command-soffice/index.js +66 -25
- package/dist/safe-bash-command-sqlite3/engine.d.ts +9 -0
- package/dist/safe-bash-command-sqlite3/index.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/index.js +851 -352
- package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
- package/dist/safe-bash-command-ssconvert/index.js +147 -80
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-truncate/index.d.ts +8 -3
- package/dist/safe-bash-command-truncate/index.js +790 -272
- package/dist/safe-bash-command-truncate/sync.d.ts +1 -0
- package/dist/safe-bash-command-truncate/sync.js +60 -0
- package/dist/safe-bash-command-wkhtmltopdf/index.js +239 -118
- package/dist/safe-bash-command-wkhtmltopdf/pdf-renderer.d.ts +1 -1
- package/dist/safe-bash-command-xxd/index.js +78 -20
- package/dist/safe-bash-command-xz/command.d.ts +4 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +1 -1
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/command.js +3 -3
- package/dist/safe-bash-contracts/default-executor.d.ts +5 -0
- package/dist/safe-bash-contracts/default-executor.js +37 -0
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +9 -9
- package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/http.d.ts +41 -0
- package/dist/safe-bash-contracts/http.js +6 -0
- package/dist/safe-bash-contracts/index.js +21 -19
- package/dist/safe-bash-contracts/io.d.ts +12 -0
- package/dist/safe-bash-contracts/io.js +4 -1
- package/dist/safe-bash-contracts/output.js +3 -2
- package/dist/safe-bash-contracts/runtime-control.js +2 -2
- package/dist/safe-bash-contracts/signals.js +1 -1
- package/dist/safe-bash-contracts/yield.d.ts +1 -0
- package/dist/safe-bash-contracts/yield.js +3 -1
- package/dist/safe-bash-csv-engine/index.d.ts +10 -1
- package/dist/safe-bash-csv-engine/index.js +78 -6
- package/dist/safe-bash-io-engine/commands/search/requirements.js +3 -3
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +3 -3
- package/dist/safe-bash-io-engine/gnu-information.d.ts +1 -1
- package/dist/safe-bash-io-engine/gnu-information.js +1 -1
- package/dist/safe-bash-io-engine/internal.d.ts +1 -1
- package/dist/safe-bash-io-engine/internal.js +2 -2
- package/dist/safe-bash-query-engine/index.js +5 -5
- package/dist/safe-bash-query-engine/interpreter.js +3 -3
- package/dist/safe-bash-query-engine/query-core.js +5 -5
- package/package.json +2 -2
- package/dist/safe-bash/chunks/chunk-2G2T5MEM.js +0 -14
- package/dist/safe-bash/chunks/chunk-FJZNUUOQ.js +0 -81
- package/dist/safe-bash/chunks/chunk-GJWUEOT6.js +0 -14
- package/dist/safe-bash/chunks/chunk-LAPF2XE6.js +0 -14
- package/dist/safe-bash/chunks/chunk-O6356Z27.js +0 -37
- package/dist/safe-bash/chunks/chunk-S2LSZFZ6.js +0 -758
- package/dist/safe-bash/chunks/chunk-T3VDYWKZ.js +0 -21
- package/dist/safe-bash/chunks/chunk-VYW4Q6KF.js +0 -12
- package/dist/safe-bash/chunks/chunk-WHURJBET.js +0 -409
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +0 -95
- package/dist/safe-bash/opt-in/commands/cmp/io.js +0 -218
- package/dist/safe-bash/command-chunks/{chunk-RTOJNFFL.js → chunk-KNI4GRXF.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/safe-bash-command-sha512sum/dist/index.js
|
|
6
6
|
init_buffer();
|
|
7
|
-
import { commandRuntimeIdentity
|
|
7
|
+
import { commandRuntimeIdentity } from "../safe-bash-contracts/index.js";
|
|
8
|
+
import { command } from "../safe-bash-checksum-engine/index.js";
|
|
9
|
+
import { sha512 } from "@noble/hashes/sha2.js";
|
|
10
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
8
11
|
function settings(options = {}) {
|
|
9
12
|
const limits = {
|
|
10
13
|
maxInputBytes: options.limits?.maxInputBytes ?? options.maxInputBytes ?? Infinity,
|
|
@@ -17,480 +20,14 @@ function settings(options = {}) {
|
|
|
17
20
|
}
|
|
18
21
|
return limits;
|
|
19
22
|
}
|
|
20
|
-
var MASK_64 = 0xffffffffffffffffn;
|
|
21
|
-
var K = [
|
|
22
|
-
0x428a2f98d728ae22n,
|
|
23
|
-
0x7137449123ef65cdn,
|
|
24
|
-
0xb5c0fbcfec4d3b2fn,
|
|
25
|
-
0xe9b5dba58189dbbcn,
|
|
26
|
-
0x3956c25bf348b538n,
|
|
27
|
-
0x59f111f1b605d019n,
|
|
28
|
-
0x923f82a4af194f9bn,
|
|
29
|
-
0xab1c5ed5da6d8118n,
|
|
30
|
-
0xd807aa98a3030242n,
|
|
31
|
-
0x12835b0145706fben,
|
|
32
|
-
0x243185be4ee4b28cn,
|
|
33
|
-
0x550c7dc3d5ffb4e2n,
|
|
34
|
-
0x72be5d74f27b896fn,
|
|
35
|
-
0x80deb1fe3b1696b1n,
|
|
36
|
-
0x9bdc06a725c71235n,
|
|
37
|
-
0xc19bf174cf692694n,
|
|
38
|
-
0xe49b69c19ef14ad2n,
|
|
39
|
-
0xefbe4786384f25e3n,
|
|
40
|
-
0x0fc19dc68b8cd5b5n,
|
|
41
|
-
0x240ca1cc77ac9c65n,
|
|
42
|
-
0x2de92c6f592b0275n,
|
|
43
|
-
0x4a7484aa6ea6e483n,
|
|
44
|
-
0x5cb0a9dcbd41fbd4n,
|
|
45
|
-
0x76f988da831153b5n,
|
|
46
|
-
0x983e5152ee66dfabn,
|
|
47
|
-
0xa831c66d2db43210n,
|
|
48
|
-
0xb00327c898fb213fn,
|
|
49
|
-
0xbf597fc7beef0ee4n,
|
|
50
|
-
0xc6e00bf33da88fc2n,
|
|
51
|
-
0xd5a79147930aa725n,
|
|
52
|
-
0x06ca6351e003826fn,
|
|
53
|
-
0x142929670a0e6e70n,
|
|
54
|
-
0x27b70a8546d22ffcn,
|
|
55
|
-
0x2e1b21385c26c926n,
|
|
56
|
-
0x4d2c6dfc5ac42aedn,
|
|
57
|
-
0x53380d139d95b3dfn,
|
|
58
|
-
0x650a73548baf63den,
|
|
59
|
-
0x766a0abb3c77b2a8n,
|
|
60
|
-
0x81c2c92e47edaee6n,
|
|
61
|
-
0x92722c851482353bn,
|
|
62
|
-
0xa2bfe8a14cf10364n,
|
|
63
|
-
0xa81a664bbc423001n,
|
|
64
|
-
0xc24b8b70d0f89791n,
|
|
65
|
-
0xc76c51a30654be30n,
|
|
66
|
-
0xd192e819d6ef5218n,
|
|
67
|
-
0xd69906245565a910n,
|
|
68
|
-
0xf40e35855771202an,
|
|
69
|
-
0x106aa07032bbd1b8n,
|
|
70
|
-
0x19a4c116b8d2d0c8n,
|
|
71
|
-
0x1e376c085141ab53n,
|
|
72
|
-
0x2748774cdf8eeb99n,
|
|
73
|
-
0x34b0bcb5e19b48a8n,
|
|
74
|
-
0x391c0cb3c5c95a63n,
|
|
75
|
-
0x4ed8aa4ae3418acbn,
|
|
76
|
-
0x5b9cca4f7763e373n,
|
|
77
|
-
0x682e6ff3d6b2b8a3n,
|
|
78
|
-
0x748f82ee5defb2fcn,
|
|
79
|
-
0x78a5636f43172f60n,
|
|
80
|
-
0x84c87814a1f0ab72n,
|
|
81
|
-
0x8cc702081a6439ecn,
|
|
82
|
-
0x90befffa23631e28n,
|
|
83
|
-
0xa4506cebde82bde9n,
|
|
84
|
-
0xbef9a3f7b2c67915n,
|
|
85
|
-
0xc67178f2e372532bn,
|
|
86
|
-
0xca273eceea26619cn,
|
|
87
|
-
0xd186b8c721c0c207n,
|
|
88
|
-
0xeada7dd6cde0eb1en,
|
|
89
|
-
0xf57d4f7fee6ed178n,
|
|
90
|
-
0x06f067aa72176fban,
|
|
91
|
-
0x0a637dc5a2c898a6n,
|
|
92
|
-
0x113f9804bef90daen,
|
|
93
|
-
0x1b710b35131c471bn,
|
|
94
|
-
0x28db77f523047d84n,
|
|
95
|
-
0x32caab7b40c72493n,
|
|
96
|
-
0x3c9ebe0a15c9bebcn,
|
|
97
|
-
0x431d67c49c100d4cn,
|
|
98
|
-
0x4cc5d4becb3e42b6n,
|
|
99
|
-
0x597f299cfc657e2an,
|
|
100
|
-
0x5fcb6fab3ad6faecn,
|
|
101
|
-
0x6c44198c4a475817n
|
|
102
|
-
];
|
|
103
|
-
function rotr(x, n) {
|
|
104
|
-
return (x >> n | x << 64n - n & MASK_64) & MASK_64;
|
|
105
|
-
}
|
|
106
23
|
function sha512Hex(data) {
|
|
107
|
-
|
|
108
|
-
let h1 = 0xbb67ae8584caa73bn;
|
|
109
|
-
let h2 = 0x3c6ef372fe94f82bn;
|
|
110
|
-
let h3 = 0xa54ff53a5f1d36f1n;
|
|
111
|
-
let h4 = 0x510e527fade682d1n;
|
|
112
|
-
let h5 = 0x9b05688c2b3e6c1fn;
|
|
113
|
-
let h6 = 0x1f83d9abfb41bd6bn;
|
|
114
|
-
let h7 = 0x5be0cd19137e2179n;
|
|
115
|
-
const bitLen = BigInt(data.byteLength) * 8n;
|
|
116
|
-
const padZeroBytes = (111 - data.byteLength % 128 + 128) % 128;
|
|
117
|
-
const totalLen = data.byteLength + 1 + padZeroBytes + 16;
|
|
118
|
-
const padded = new Uint8Array(totalLen);
|
|
119
|
-
padded.set(data, 0);
|
|
120
|
-
padded[data.byteLength] = 128;
|
|
121
|
-
const view = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
|
|
122
|
-
view.setBigUint64(totalLen - 16, bitLen >> 64n, false);
|
|
123
|
-
view.setBigUint64(totalLen - 8, bitLen & MASK_64, false);
|
|
124
|
-
const W = new Array(80).fill(0n);
|
|
125
|
-
for (let offset = 0; offset < totalLen; offset += 128) {
|
|
126
|
-
for (let i = 0; i < 16; i++) {
|
|
127
|
-
W[i] = view.getBigUint64(offset + i * 8, false);
|
|
128
|
-
}
|
|
129
|
-
for (let i = 16; i < 80; i++) {
|
|
130
|
-
const w15 = W[i - 15];
|
|
131
|
-
const w2 = W[i - 2];
|
|
132
|
-
const s0 = rotr(w15, 1n) ^ rotr(w15, 8n) ^ w15 >> 7n;
|
|
133
|
-
const s1 = rotr(w2, 19n) ^ rotr(w2, 61n) ^ w2 >> 6n;
|
|
134
|
-
W[i] = W[i - 16] + s0 + W[i - 7] + s1 & MASK_64;
|
|
135
|
-
}
|
|
136
|
-
let a = h0;
|
|
137
|
-
let b = h1;
|
|
138
|
-
let c = h2;
|
|
139
|
-
let d = h3;
|
|
140
|
-
let e = h4;
|
|
141
|
-
let f = h5;
|
|
142
|
-
let g = h6;
|
|
143
|
-
let h = h7;
|
|
144
|
-
for (let i = 0; i < 80; i++) {
|
|
145
|
-
const S1 = rotr(e, 14n) ^ rotr(e, 18n) ^ rotr(e, 41n);
|
|
146
|
-
const ch = e & f ^ ~e & MASK_64 & g;
|
|
147
|
-
const temp1 = h + S1 + ch + K[i] + W[i] & MASK_64;
|
|
148
|
-
const S0 = rotr(a, 28n) ^ rotr(a, 34n) ^ rotr(a, 39n);
|
|
149
|
-
const maj = a & b ^ a & c ^ b & c;
|
|
150
|
-
const temp2 = S0 + maj & MASK_64;
|
|
151
|
-
h = g;
|
|
152
|
-
g = f;
|
|
153
|
-
f = e;
|
|
154
|
-
e = d + temp1 & MASK_64;
|
|
155
|
-
d = c;
|
|
156
|
-
c = b;
|
|
157
|
-
b = a;
|
|
158
|
-
a = temp1 + temp2 & MASK_64;
|
|
159
|
-
}
|
|
160
|
-
h0 = h0 + a & MASK_64;
|
|
161
|
-
h1 = h1 + b & MASK_64;
|
|
162
|
-
h2 = h2 + c & MASK_64;
|
|
163
|
-
h3 = h3 + d & MASK_64;
|
|
164
|
-
h4 = h4 + e & MASK_64;
|
|
165
|
-
h5 = h5 + f & MASK_64;
|
|
166
|
-
h6 = h6 + g & MASK_64;
|
|
167
|
-
h7 = h7 + h & MASK_64;
|
|
168
|
-
}
|
|
169
|
-
return [h0, h1, h2, h3, h4, h5, h6, h7].map((v) => v.toString(16).padStart(16, "0")).join("");
|
|
170
|
-
}
|
|
171
|
-
var HELP_TEXT = `Usage: sha512sum [OPTION]... [FILE]...
|
|
172
|
-
Print or check SHA512 (512-bit) checksums.
|
|
173
|
-
|
|
174
|
-
With no FILE, or when FILE is -, read standard input.
|
|
175
|
-
|
|
176
|
-
-b, --binary read in binary mode
|
|
177
|
-
-c, --check read SHA512 sums from the FILEs and check them
|
|
178
|
-
--tag create a BSD-style checksum
|
|
179
|
-
-t, --text read in text mode (default)
|
|
180
|
-
-z, --zero end each output line with NUL, not newline,
|
|
181
|
-
and disable file name escaping
|
|
182
|
-
|
|
183
|
-
The following five options are useful only when verifying checksums:
|
|
184
|
-
--ignore-missing don't fail or report status for missing files
|
|
185
|
-
--quiet don't print OK for each successfully verified file
|
|
186
|
-
--status don't output anything, status code shows success
|
|
187
|
-
--strict exit non-zero for improperly formatted checksum lines
|
|
188
|
-
-w, --warn warn about improperly formatted checksum lines
|
|
189
|
-
|
|
190
|
-
--help display this help and exit
|
|
191
|
-
--version output version information and exit
|
|
192
|
-
`;
|
|
193
|
-
var VERSION_TEXT = `sha512sum (Sandbox VFS-ish/GNU coreutils) 9.7
|
|
194
|
-
`;
|
|
195
|
-
function resolveVfsPath(cwd, target) {
|
|
196
|
-
const raw = target.startsWith("/") ? target : cwd.endsWith("/") ? cwd + target : `${cwd}/${target}`;
|
|
197
|
-
const parts = raw.split("/");
|
|
198
|
-
const stack = [];
|
|
199
|
-
for (const part of parts) {
|
|
200
|
-
if (!part || part === ".")
|
|
201
|
-
continue;
|
|
202
|
-
if (part === "..")
|
|
203
|
-
stack.pop();
|
|
204
|
-
else
|
|
205
|
-
stack.push(part);
|
|
206
|
-
}
|
|
207
|
-
return "/" + stack.join("/");
|
|
208
|
-
}
|
|
209
|
-
function escapeFilename(name, zero) {
|
|
210
|
-
if (zero)
|
|
211
|
-
return { prefix: "", rendered: name };
|
|
212
|
-
if (!name.includes("\\") && !name.includes("\n") && !name.includes("\r")) {
|
|
213
|
-
return { prefix: "", rendered: name };
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
prefix: "\\",
|
|
217
|
-
rendered: name.replace(/\\/g, "\\\\").replace(/\n/g, "\\n").replace(/\r/g, "\\r")
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
function unescapeFilename(name) {
|
|
221
|
-
let out = "";
|
|
222
|
-
for (let i = 0; i < name.length; i++) {
|
|
223
|
-
const ch = name[i];
|
|
224
|
-
if (ch === "\\" && i + 1 < name.length) {
|
|
225
|
-
const next = name[++i];
|
|
226
|
-
if (next === "n")
|
|
227
|
-
out += "\n";
|
|
228
|
-
else if (next === "r")
|
|
229
|
-
out += "\r";
|
|
230
|
-
else if (next === "\\")
|
|
231
|
-
out += "\\";
|
|
232
|
-
else
|
|
233
|
-
out += "\\" + next;
|
|
234
|
-
} else {
|
|
235
|
-
out += ch;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return out;
|
|
24
|
+
return bytesToHex(sha512(data));
|
|
239
25
|
}
|
|
240
26
|
function createSha512sumCommand(options = {}) {
|
|
241
27
|
const limits = settings(options);
|
|
242
28
|
return {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
runtimeIdentity: commandRuntimeIdentity,
|
|
246
|
-
async execute(context) {
|
|
247
|
-
context.signal.throwIfAborted();
|
|
248
|
-
let binary = false;
|
|
249
|
-
let check = false;
|
|
250
|
-
let tag = false;
|
|
251
|
-
let zero = false;
|
|
252
|
-
let ignoreMissing = false;
|
|
253
|
-
let quiet = false;
|
|
254
|
-
let statusOnly = false;
|
|
255
|
-
let strict = false;
|
|
256
|
-
let warn = false;
|
|
257
|
-
const operands = [];
|
|
258
|
-
let endOfOptions = false;
|
|
259
|
-
for (let i = 0; i < context.args.length; i++) {
|
|
260
|
-
const arg = context.args[i];
|
|
261
|
-
if (!endOfOptions && arg === "--") {
|
|
262
|
-
endOfOptions = true;
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
if (!endOfOptions && arg === "--help") {
|
|
266
|
-
await writeText(context.stdout, HELP_TEXT);
|
|
267
|
-
return { exitCode: 0 };
|
|
268
|
-
}
|
|
269
|
-
if (!endOfOptions && arg === "--version") {
|
|
270
|
-
await writeText(context.stdout, VERSION_TEXT);
|
|
271
|
-
return { exitCode: 0 };
|
|
272
|
-
}
|
|
273
|
-
if (!endOfOptions && arg.startsWith("--") && arg.length > 2) {
|
|
274
|
-
switch (arg) {
|
|
275
|
-
case "--binary":
|
|
276
|
-
binary = true;
|
|
277
|
-
break;
|
|
278
|
-
case "--text":
|
|
279
|
-
binary = false;
|
|
280
|
-
break;
|
|
281
|
-
case "--check":
|
|
282
|
-
check = true;
|
|
283
|
-
break;
|
|
284
|
-
case "--tag":
|
|
285
|
-
tag = true;
|
|
286
|
-
binary = true;
|
|
287
|
-
break;
|
|
288
|
-
case "--zero":
|
|
289
|
-
zero = true;
|
|
290
|
-
break;
|
|
291
|
-
case "--ignore-missing":
|
|
292
|
-
ignoreMissing = true;
|
|
293
|
-
break;
|
|
294
|
-
case "--quiet":
|
|
295
|
-
quiet = true;
|
|
296
|
-
break;
|
|
297
|
-
case "--status":
|
|
298
|
-
statusOnly = true;
|
|
299
|
-
break;
|
|
300
|
-
case "--strict":
|
|
301
|
-
strict = true;
|
|
302
|
-
break;
|
|
303
|
-
case "--warn":
|
|
304
|
-
warn = true;
|
|
305
|
-
break;
|
|
306
|
-
default:
|
|
307
|
-
await writeText(context.stderr, `sha512sum: unrecognized option '${arg}'
|
|
308
|
-
`);
|
|
309
|
-
return { exitCode: 1 };
|
|
310
|
-
}
|
|
311
|
-
continue;
|
|
312
|
-
}
|
|
313
|
-
if (!endOfOptions && arg.startsWith("-") && arg.length > 1) {
|
|
314
|
-
for (let j = 1; j < arg.length; j++) {
|
|
315
|
-
const ch = arg[j];
|
|
316
|
-
switch (ch) {
|
|
317
|
-
case "b":
|
|
318
|
-
binary = true;
|
|
319
|
-
break;
|
|
320
|
-
case "t":
|
|
321
|
-
binary = false;
|
|
322
|
-
break;
|
|
323
|
-
case "c":
|
|
324
|
-
check = true;
|
|
325
|
-
break;
|
|
326
|
-
case "z":
|
|
327
|
-
zero = true;
|
|
328
|
-
break;
|
|
329
|
-
case "w":
|
|
330
|
-
warn = true;
|
|
331
|
-
break;
|
|
332
|
-
default:
|
|
333
|
-
await writeText(context.stderr, `sha512sum: invalid option -- '${ch}'
|
|
334
|
-
`);
|
|
335
|
-
return { exitCode: 1 };
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
|
-
operands.push(arg);
|
|
341
|
-
}
|
|
342
|
-
if (tag && check) {
|
|
343
|
-
await writeText(context.stderr, "sha512sum: the --tag option is meaningless when verifying checksums\n");
|
|
344
|
-
return { exitCode: 1 };
|
|
345
|
-
}
|
|
346
|
-
const targets = operands.length > 0 ? operands : ["-"];
|
|
347
|
-
let totalInputBytes = 0;
|
|
348
|
-
let stdinConsumed = false;
|
|
349
|
-
let stdinCache = new Uint8Array(0);
|
|
350
|
-
const readTargetBytes = async (target) => {
|
|
351
|
-
let bytes;
|
|
352
|
-
if (target === "-") {
|
|
353
|
-
if (!stdinConsumed) {
|
|
354
|
-
stdinConsumed = true;
|
|
355
|
-
stdinCache = await collectBytes(context.stdin, { signal: context.signal });
|
|
356
|
-
}
|
|
357
|
-
bytes = stdinCache;
|
|
358
|
-
} else {
|
|
359
|
-
const resolved = resolveVfsPath(context.cwd, target);
|
|
360
|
-
bytes = await context.fs.readFile(resolved, { signal: context.signal });
|
|
361
|
-
}
|
|
362
|
-
totalInputBytes += bytes.byteLength;
|
|
363
|
-
if (totalInputBytes > limits.maxInputBytes) {
|
|
364
|
-
throw new Error("input byte budget exceeded");
|
|
365
|
-
}
|
|
366
|
-
return bytes;
|
|
367
|
-
};
|
|
368
|
-
let exitCode = 0;
|
|
369
|
-
const eol = zero ? "\0" : "\n";
|
|
370
|
-
if (!check) {
|
|
371
|
-
let out = "";
|
|
372
|
-
for (const target of targets) {
|
|
373
|
-
try {
|
|
374
|
-
const bytes = await readTargetBytes(target);
|
|
375
|
-
const hex = sha512Hex(bytes);
|
|
376
|
-
const { prefix, rendered } = escapeFilename(target, zero);
|
|
377
|
-
if (tag) {
|
|
378
|
-
out += `${prefix}SHA512 (${rendered}) = ${hex}${eol}`;
|
|
379
|
-
} else {
|
|
380
|
-
out += `${prefix}${hex} ${binary ? "*" : " "}${rendered}${eol}`;
|
|
381
|
-
}
|
|
382
|
-
} catch {
|
|
383
|
-
await writeText(context.stderr, `sha512sum: ${target}: No such file or directory
|
|
384
|
-
`);
|
|
385
|
-
exitCode = 1;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
if (out)
|
|
389
|
-
await writeText(context.stdout, out);
|
|
390
|
-
return { exitCode };
|
|
391
|
-
}
|
|
392
|
-
for (const manifestFile of targets) {
|
|
393
|
-
let manifestBytes;
|
|
394
|
-
try {
|
|
395
|
-
manifestBytes = await readTargetBytes(manifestFile);
|
|
396
|
-
} catch {
|
|
397
|
-
await writeText(context.stderr, `sha512sum: ${manifestFile}: No such file or directory
|
|
398
|
-
`);
|
|
399
|
-
exitCode = 1;
|
|
400
|
-
continue;
|
|
401
|
-
}
|
|
402
|
-
const text = new TextDecoder().decode(manifestBytes);
|
|
403
|
-
const lines = text.split(/\r?\n/);
|
|
404
|
-
let validLines = 0;
|
|
405
|
-
let malformedLines = 0;
|
|
406
|
-
let failedReads = 0;
|
|
407
|
-
let mismatches = 0;
|
|
408
|
-
let matchedFiles = 0;
|
|
409
|
-
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
410
|
-
const rawLine = lines[lineIdx];
|
|
411
|
-
if (!rawLine || rawLine.startsWith("#"))
|
|
412
|
-
continue;
|
|
413
|
-
let line = rawLine;
|
|
414
|
-
let escaped = false;
|
|
415
|
-
if (line.startsWith("\\")) {
|
|
416
|
-
escaped = true;
|
|
417
|
-
line = line.slice(1);
|
|
418
|
-
}
|
|
419
|
-
let expectedHex = "";
|
|
420
|
-
let filename = "";
|
|
421
|
-
const tagMatch = /^SHA512 \((.+)\) = ([0-9a-fA-F]{128})$/.exec(line);
|
|
422
|
-
const stdMatch = /^([0-9a-fA-F]{128}) [ *](.+)$/.exec(line);
|
|
423
|
-
if (tagMatch) {
|
|
424
|
-
filename = escaped ? unescapeFilename(tagMatch[1]) : tagMatch[1];
|
|
425
|
-
expectedHex = tagMatch[2].toLowerCase();
|
|
426
|
-
} else if (stdMatch) {
|
|
427
|
-
expectedHex = stdMatch[1].toLowerCase();
|
|
428
|
-
filename = escaped ? unescapeFilename(stdMatch[2]) : stdMatch[2];
|
|
429
|
-
} else {
|
|
430
|
-
malformedLines++;
|
|
431
|
-
if (warn) {
|
|
432
|
-
await writeText(context.stderr, `sha512sum: ${manifestFile}: ${lineIdx + 1}: improperly formatted SHA512 checksum line
|
|
433
|
-
`);
|
|
434
|
-
}
|
|
435
|
-
continue;
|
|
436
|
-
}
|
|
437
|
-
validLines++;
|
|
438
|
-
let targetBytes;
|
|
439
|
-
try {
|
|
440
|
-
targetBytes = await readTargetBytes(filename);
|
|
441
|
-
} catch {
|
|
442
|
-
if (ignoreMissing)
|
|
443
|
-
continue;
|
|
444
|
-
failedReads++;
|
|
445
|
-
if (!statusOnly) {
|
|
446
|
-
await writeText(context.stderr, `sha512sum: ${filename}: No such file or directory
|
|
447
|
-
`);
|
|
448
|
-
await writeText(context.stdout, `${filename}: FAILED open or read
|
|
449
|
-
`);
|
|
450
|
-
}
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
const actualHex = sha512Hex(targetBytes);
|
|
454
|
-
if (actualHex === expectedHex) {
|
|
455
|
-
matchedFiles++;
|
|
456
|
-
if (!statusOnly && !quiet) {
|
|
457
|
-
await writeText(context.stdout, `${filename}: OK
|
|
458
|
-
`);
|
|
459
|
-
}
|
|
460
|
-
} else {
|
|
461
|
-
mismatches++;
|
|
462
|
-
if (!statusOnly) {
|
|
463
|
-
await writeText(context.stdout, `${filename}: FAILED
|
|
464
|
-
`);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
if (validLines === 0) {
|
|
469
|
-
await writeText(context.stderr, `sha512sum: ${manifestFile}: no properly formatted SHA512 checksum lines found
|
|
470
|
-
`);
|
|
471
|
-
exitCode = 1;
|
|
472
|
-
} else {
|
|
473
|
-
if (!statusOnly) {
|
|
474
|
-
if (malformedLines > 0) {
|
|
475
|
-
await writeText(context.stderr, `sha512sum: WARNING: ${malformedLines} line is improperly formatted
|
|
476
|
-
`);
|
|
477
|
-
}
|
|
478
|
-
if (failedReads > 0) {
|
|
479
|
-
await writeText(context.stderr, `sha512sum: WARNING: ${failedReads} listed file could not be read
|
|
480
|
-
`);
|
|
481
|
-
}
|
|
482
|
-
if (mismatches > 0) {
|
|
483
|
-
await writeText(context.stderr, `sha512sum: WARNING: ${mismatches} computed checksum did NOT match
|
|
484
|
-
`);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
if (failedReads > 0 || mismatches > 0 || strict && malformedLines > 0 || ignoreMissing && matchedFiles === 0) {
|
|
488
|
-
exitCode = 1;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
return { exitCode };
|
|
493
|
-
}
|
|
29
|
+
...command("sha512sum", "sha512", limits.maxInputBytes, limits.maxArgumentBytes),
|
|
30
|
+
runtimeIdentity: commandRuntimeIdentity
|
|
494
31
|
};
|
|
495
32
|
}
|
|
496
33
|
function createSha512sumCommands(options = {}) {
|
|
@@ -502,14 +39,14 @@ function sha512sumCommands(options = {}) {
|
|
|
502
39
|
name: "sha512sum-commands",
|
|
503
40
|
setup(host) {
|
|
504
41
|
if (!options.replace) {
|
|
505
|
-
for (const
|
|
506
|
-
if (host.commands.has(
|
|
507
|
-
throw new Error(`Command already registered: ${
|
|
42
|
+
for (const command2 of commands) {
|
|
43
|
+
if (host.commands.has(command2.name)) {
|
|
44
|
+
throw new Error(`Command already registered: ${command2.name}`);
|
|
508
45
|
}
|
|
509
46
|
}
|
|
510
47
|
}
|
|
511
|
-
for (const
|
|
512
|
-
host.commands.register(
|
|
48
|
+
for (const command2 of commands) {
|
|
49
|
+
host.commands.register(command2, { replace: options.replace ?? false });
|
|
513
50
|
}
|
|
514
51
|
}
|
|
515
52
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type CommandDefinition } from "../safe-bash-contracts/command.js";
|
|
2
2
|
import type { VirtualShellPlugin } from "../safe-bash-contracts/plugin.js";
|
|
3
|
+
export interface SipsLimits {
|
|
4
|
+
readonly maxInputBytes: number;
|
|
5
|
+
}
|
|
3
6
|
export interface SipsCommandOptions {
|
|
7
|
+
readonly limits?: Partial<SipsLimits>;
|
|
4
8
|
readonly replace?: boolean;
|
|
5
9
|
}
|
|
6
10
|
export interface SipsCliResult {
|
|
@@ -8,12 +12,12 @@ export interface SipsCliResult {
|
|
|
8
12
|
readonly stdout: string;
|
|
9
13
|
readonly stderr: string;
|
|
10
14
|
}
|
|
11
|
-
export declare function runSipsCli(argv: readonly string[], files: Map<string, Uint8Array
|
|
12
|
-
export declare function runSipsCliSync(argv: readonly string[], files: Map<string, Uint8Array
|
|
13
|
-
export declare function runIdentifyCli(argv: readonly string[], files: Map<string, Uint8Array
|
|
14
|
-
export declare function createSipsCommand(
|
|
15
|
+
export declare function runSipsCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<SipsCliResult>;
|
|
16
|
+
export declare function runSipsCliSync(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): SipsCliResult;
|
|
17
|
+
export declare function runIdentifyCli(argv: readonly string[], files: Map<string, Uint8Array>, signal?: AbortSignal): Promise<SipsCliResult>;
|
|
18
|
+
export declare function createSipsCommand(options?: SipsCommandOptions): CommandDefinition;
|
|
15
19
|
export declare const sipsCommand: CommandDefinition;
|
|
16
|
-
export declare function createIdentifyCommand(
|
|
20
|
+
export declare function createIdentifyCommand(options?: SipsCommandOptions): CommandDefinition;
|
|
17
21
|
export declare const identifyCommand: CommandDefinition;
|
|
18
22
|
export declare function sipsPlugin(options?: SipsCommandOptions): VirtualShellPlugin;
|
|
19
23
|
export declare const sipsCommands: typeof sipsPlugin;
|