@poe-platform/safe-bash 0.1.630 → 0.1.632
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 -0
- package/dist/office-package/compression.d.ts +19 -0
- package/dist/office-package/compression.js +186 -0
- package/dist/office-package/runtime.d.ts +11 -0
- package/dist/office-package/runtime.js +28 -0
- package/dist/safe-bash/chunks/{bz2-B2RXT4EX.js → bz2-ACU4EOVE.js} +2 -2
- package/dist/safe-bash/chunks/chunk-2E4KBFO6.js +239 -0
- package/dist/safe-bash/chunks/chunk-2E4KBFO6.js.map +7 -0
- package/dist/safe-bash/chunks/chunk-3E5M2WEL.js +33 -0
- package/dist/safe-bash/chunks/chunk-3E5M2WEL.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-KQ6J7JHQ.js → chunk-3LD67SER.js} +12 -10
- package/dist/safe-bash/chunks/{chunk-KQ6J7JHQ.js.map → chunk-3LD67SER.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-6LSSEOG7.js → chunk-6HNK7Q66.js} +11 -7
- package/dist/safe-bash/chunks/{chunk-6LSSEOG7.js.map → chunk-6HNK7Q66.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-AD7UAP5B.js → chunk-7EEWZY5S.js} +10 -8
- package/dist/safe-bash/chunks/{chunk-AD7UAP5B.js.map → chunk-7EEWZY5S.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-RNKTWFEM.js → chunk-CDBQXRWL.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-UYX72YHY.js → chunk-CHHAB5SS.js} +10 -74
- package/dist/safe-bash/chunks/{chunk-UYX72YHY.js.map → chunk-CHHAB5SS.js.map} +3 -3
- package/dist/safe-bash/chunks/{chunk-6YSBXTTJ.js → chunk-EI4X5ETX.js} +12 -10
- package/dist/safe-bash/chunks/{chunk-6YSBXTTJ.js.map → chunk-EI4X5ETX.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-KZ7QCYNT.js → chunk-GIBLUW2U.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-KZ7QCYNT.js.map → chunk-GIBLUW2U.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-GPV7ZFYS.js +1528 -0
- package/dist/safe-bash/chunks/chunk-GPV7ZFYS.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-N5CYTGBN.js → chunk-H3E67KTZ.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-N5CYTGBN.js.map → chunk-H3E67KTZ.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-AFH57PPL.js → chunk-IEKESMO4.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-DPJWEGIX.js → chunk-JLBIUYT3.js} +2 -2
- package/dist/safe-bash/chunks/chunk-JZDO5MC3.js +77 -0
- package/dist/safe-bash/chunks/chunk-JZDO5MC3.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-GFZKQIPL.js → chunk-LA6BX562.js} +8 -6
- package/dist/safe-bash/chunks/{chunk-GFZKQIPL.js.map → chunk-LA6BX562.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-PVJJFCGA.js → chunk-M3GPCYSP.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-FWDMJTQO.js → chunk-NDCZ3UBP.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-FWDMJTQO.js.map → chunk-NDCZ3UBP.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-2KL6W6NB.js → chunk-O2EVBRKF.js} +1 -2
- package/dist/safe-bash/chunks/chunk-OFT77XIB.js +389 -0
- package/dist/safe-bash/chunks/chunk-OFT77XIB.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-PCLOK32J.js → chunk-PC6BEIAF.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-PCLOK32J.js.map → chunk-PC6BEIAF.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-3M5F7LD5.js → chunk-QWKP7ZU7.js} +13 -9
- package/dist/safe-bash/chunks/{chunk-3M5F7LD5.js.map → chunk-QWKP7ZU7.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-THXJ6CLF.js +53 -0
- package/dist/safe-bash/chunks/chunk-THXJ6CLF.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-K7W6Q6FN.js → chunk-V73A742N.js} +58 -16
- package/dist/safe-bash/chunks/chunk-V73A742N.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-4BYUV5PA.js → chunk-VN3ZGME3.js} +12 -8
- package/dist/safe-bash/chunks/{chunk-4BYUV5PA.js.map → chunk-VN3ZGME3.js.map} +1 -1
- package/dist/safe-bash/chunks/{chunk-3BZ5NQ73.js → chunk-WECHUK3Y.js} +369 -36
- package/dist/safe-bash/chunks/chunk-WECHUK3Y.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-X55AMTNM.js → chunk-WIOEUR7D.js} +14 -10
- package/dist/safe-bash/chunks/{chunk-X55AMTNM.js.map → chunk-WIOEUR7D.js.map} +1 -1
- package/dist/safe-bash/chunks/chunk-WPIOO4NX.js +443 -0
- package/dist/safe-bash/chunks/chunk-WPIOO4NX.js.map +7 -0
- package/dist/safe-bash/chunks/{chunk-C7QNJ3D4.js → chunk-WYTI64IU.js} +2 -2
- package/dist/safe-bash/chunks/{xz-AVXFDXW4.js → xz-U4QDTPZL.js} +2 -2
- package/dist/safe-bash/chunks/{zstd-R6RPHJYO.js → zstd-OG5RPYXO.js} +2 -2
- package/dist/safe-bash/commands/archive/zip/crc.d.ts +2 -0
- package/dist/safe-bash/commands/archive/zip/crc.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crc.js +7 -0
- package/dist/safe-bash/commands/archive/zip/crc.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crypto.d.ts +4 -0
- package/dist/safe-bash/commands/archive/zip/crypto.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/crypto.js +34 -0
- package/dist/safe-bash/commands/archive/zip/crypto.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/help.d.ts +3 -0
- package/dist/safe-bash/commands/archive/zip/help.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/help.js +87 -0
- package/dist/safe-bash/commands/archive/zip/help.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/move.d.ts +12 -0
- package/dist/safe-bash/commands/archive/zip/move.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/move.js +60 -0
- package/dist/safe-bash/commands/archive/zip/move.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/options.js +5 -5
- package/dist/safe-bash/commands/archive/zip/options.js.map +1 -1
- package/dist/safe-bash/commands/archive/zip-format.d.ts +1 -1
- package/dist/safe-bash/commands/archive/zip-format.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/zip-format.js +14 -17
- package/dist/safe-bash/commands/archive/zip-format.js.map +1 -1
- package/dist/safe-bash/commands/archive/zip.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/zip.js +45 -15
- package/dist/safe-bash/commands/archive/zip.js.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.d.ts +2 -0
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.d.ts.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.js +4 -0
- package/dist/safe-bash/commands/bytes/compression/bounded-codec.js.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/codec.d.ts +4 -24
- package/dist/safe-bash/commands/bytes/compression/codec.d.ts.map +1 -1
- package/dist/safe-bash/commands/bytes/compression/codec.js +12 -168
- package/dist/safe-bash/commands/bytes/compression/codec.js.map +1 -1
- package/dist/safe-bash/commands/cmp.js +1 -1
- package/dist/safe-bash/commands/cmp.js.map +1 -1
- package/dist/safe-bash/commands/csplit/index.browser.js +10 -7
- package/dist/safe-bash/commands/docx/index.browser.js +54 -0
- package/dist/safe-bash/commands/docx/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/docx/index.d.ts +25 -0
- package/dist/safe-bash/commands/docx/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/docx/index.js +42 -0
- package/dist/safe-bash/commands/docx/index.js.map +1 -0
- package/dist/safe-bash/commands/docx/io.d.ts +15 -0
- package/dist/safe-bash/commands/docx/io.d.ts.map +1 -0
- package/dist/safe-bash/commands/docx/io.js +16 -0
- package/dist/safe-bash/commands/docx/io.js.map +1 -0
- package/dist/safe-bash/commands/factor/index.browser.js +7 -5
- package/dist/safe-bash/commands/filesystem.d.ts.map +1 -1
- package/dist/safe-bash/commands/filesystem.js +9 -1
- package/dist/safe-bash/commands/filesystem.js.map +1 -1
- package/dist/safe-bash/commands/getopt/index.browser.js +7 -5
- package/dist/safe-bash/commands/hexdump/index.browser.js +8 -6
- package/dist/safe-bash/commands/iconv/index.browser.js +8 -6
- package/dist/safe-bash/commands/line-endings/index.browser.js +10 -7
- package/dist/safe-bash/commands/llm/index.browser.js +10 -8
- package/dist/safe-bash/commands/llm/providers/index.browser.js +3 -3
- package/dist/safe-bash/commands/network/index.browser.js +11 -8
- package/dist/safe-bash/commands/node/index.browser.js +8 -6
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/op/index.js +0 -1
- package/dist/safe-bash/commands/op/index.js.map +2 -2
- package/dist/safe-bash/commands/pptx/index.d.ts +29 -0
- package/dist/safe-bash/commands/pptx/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/pptx/index.js +153 -0
- package/dist/safe-bash/commands/pptx/index.js.map +1 -0
- package/dist/safe-bash/commands/pr/index.browser.js +8 -6
- package/dist/safe-bash/commands/predicates.js +1 -1
- package/dist/safe-bash/commands/python/execution.d.ts +3 -0
- package/dist/safe-bash/commands/python/execution.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/execution.js +193 -0
- package/dist/safe-bash/commands/python/execution.js.map +1 -0
- package/dist/safe-bash/commands/python/index.browser.js +21 -0
- package/dist/safe-bash/commands/python/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/python/index.d.ts +49 -0
- package/dist/safe-bash/commands/python/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/index.js +317 -0
- package/dist/safe-bash/commands/python/index.js.map +1 -0
- package/dist/safe-bash/commands/python/installation.d.ts +9 -0
- package/dist/safe-bash/commands/python/installation.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/installation.js +80 -0
- package/dist/safe-bash/commands/python/installation.js.map +1 -0
- package/dist/safe-bash/commands/python/invocation.d.ts +10 -0
- package/dist/safe-bash/commands/python/invocation.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/invocation.js +81 -0
- package/dist/safe-bash/commands/python/invocation.js.map +1 -0
- package/dist/safe-bash/commands/python/node.d.ts +12 -0
- package/dist/safe-bash/commands/python/node.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/node.js +33 -0
- package/dist/safe-bash/commands/python/node.js.map +1 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.d.ts +5 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.js +179 -0
- package/dist/safe-bash/commands/python/provisioning-runtime.js.map +1 -0
- package/dist/safe-bash/commands/python/provisioning.d.ts +49 -0
- package/dist/safe-bash/commands/python/provisioning.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/provisioning.js +320 -0
- package/dist/safe-bash/commands/python/provisioning.js.map +1 -0
- package/dist/safe-bash/commands/python/reply.d.ts +3 -0
- package/dist/safe-bash/commands/python/reply.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/reply.js +103 -0
- package/dist/safe-bash/commands/python/reply.js.map +1 -0
- package/dist/safe-bash/commands/python/worker.browser.js +736 -0
- package/dist/safe-bash/commands/python/worker.browser.js.map +7 -0
- package/dist/safe-bash/commands/python/worker.d.ts +47 -0
- package/dist/safe-bash/commands/python/worker.d.ts.map +1 -0
- package/dist/safe-bash/commands/python/worker.js +373 -0
- package/dist/safe-bash/commands/python/worker.js.map +1 -0
- package/dist/safe-bash/commands/tsort/index.browser.js +8 -6
- package/dist/safe-bash/commands/xml/index.browser.js +9 -7
- package/dist/safe-bash/commands/yq/index.browser.js +10 -8
- package/dist/safe-bash/commands/yq/index.d.ts.map +1 -1
- package/dist/safe-bash/commands/yq/index.js +32 -4
- package/dist/safe-bash/commands/yq/index.js.map +1 -1
- package/dist/safe-bash/commands/yq/parser.d.ts.map +1 -1
- package/dist/safe-bash/commands/yq/parser.js +21 -5
- package/dist/safe-bash/commands/yq/parser.js.map +1 -1
- package/dist/safe-bash/contracts/command.d.ts +2 -0
- package/dist/safe-bash/contracts/command.d.ts.map +1 -1
- package/dist/safe-bash/contracts/command.js +6 -2
- package/dist/safe-bash/contracts/command.js.map +1 -1
- package/dist/safe-bash/contracts/filesystem-descriptor.d.ts +13 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.d.ts.map +1 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.js +189 -0
- package/dist/safe-bash/contracts/filesystem-descriptor.js.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.d.ts +15 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.d.ts.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.js +69 -0
- package/dist/safe-bash/contracts/filesystem-output-budget.js.map +1 -0
- package/dist/safe-bash/contracts/filesystem-output.d.ts +11 -5
- package/dist/safe-bash/contracts/filesystem-output.d.ts.map +1 -1
- package/dist/safe-bash/contracts/filesystem-output.js +229 -20
- package/dist/safe-bash/contracts/filesystem-output.js.map +1 -1
- package/dist/safe-bash/contracts/io.d.ts +29 -0
- package/dist/safe-bash/contracts/io.d.ts.map +1 -1
- package/dist/safe-bash/contracts/io.js +317 -37
- package/dist/safe-bash/contracts/io.js.map +1 -1
- package/dist/safe-bash/core.browser.js +5502 -2210
- package/dist/safe-bash/core.browser.js.map +4 -4
- package/dist/safe-bash/core.d.ts +1 -0
- package/dist/safe-bash/core.d.ts.map +1 -1
- package/dist/safe-bash/core.js +1 -0
- package/dist/safe-bash/core.js.map +1 -1
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +95 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.js +99 -0
- package/dist/safe-bash/opt-in/commands/cmp/io.js +218 -0
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +24 -0
- package/dist/safe-bash/opt-in/commands/cmp/options.js +195 -0
- package/dist/safe-bash/opt-in/commands/dd/conversions.js +152 -0
- package/dist/safe-bash/opt-in/commands/dd/index.d.ts +18 -0
- package/dist/safe-bash/opt-in/commands/dd/index.js +561 -0
- package/dist/safe-bash/opt-in/commands/dd/io.d.ts +31 -0
- package/dist/safe-bash/opt-in/commands/dd/io.js +244 -0
- package/dist/safe-bash/opt-in/commands/dd/options.js +184 -0
- package/dist/safe-bash/opt-in/commands/dd/report.js +69 -0
- package/dist/safe-bash/opt-in/commands/install/arguments.js +224 -0
- package/dist/safe-bash/opt-in/commands/install/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/install/index.js +678 -0
- package/dist/safe-bash/opt-in/commands/install/mode.js +71 -0
- package/dist/safe-bash/opt-in/commands/install/options.d.ts +36 -0
- package/dist/safe-bash/opt-in/commands/install/options.js +27 -0
- package/dist/safe-bash/opt-in/commands/shuf/args.js +179 -0
- package/dist/safe-bash/opt-in/commands/shuf/index.d.ts +6 -0
- package/dist/safe-bash/opt-in/commands/shuf/index.js +20 -0
- package/dist/safe-bash/opt-in/commands/shuf/input.js +93 -0
- package/dist/safe-bash/opt-in/commands/shuf/options.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/shuf/options.js +8 -0
- package/dist/safe-bash/opt-in/commands/shuf/random.js +114 -0
- package/dist/safe-bash/opt-in/commands/shuf/shuf.d.ts +3 -0
- package/dist/safe-bash/opt-in/commands/shuf/shuf.js +230 -0
- package/dist/safe-bash/opt-in/commands/shuf/usage.js +24 -0
- package/dist/safe-bash/opt-in/commands/truncate/arguments.js +186 -0
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/truncate/index.js +244 -0
- package/dist/safe-bash/opt-in/commands/yes/index.d.ts +11 -0
- package/dist/safe-bash/opt-in/commands/yes/index.js +167 -0
- package/dist/safe-bash/opt-in/commands/yq/arguments.js +177 -0
- package/dist/safe-bash/opt-in/commands/yq/evaluate.js +564 -0
- package/dist/safe-bash/opt-in/commands/yq/expression.js +183 -0
- package/dist/safe-bash/opt-in/commands/yq/inplace.js +65 -0
- package/dist/safe-bash/opt-in/commands/yq/mike.d.ts +9 -0
- package/dist/safe-bash/opt-in/commands/yq/mike.js +192 -0
- package/dist/safe-bash/opt-in/commands/yq/native-encoder.js +165 -0
- package/dist/safe-bash/opt-in/commands/yq/native-work.d.ts +44 -0
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +188 -0
- package/dist/safe-bash/opt-in/commands/yq/nodes.js +621 -0
- package/dist/safe-bash/opt-in/entrypoints/arrays.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/arrays.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/cmp.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/cmp.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/dd.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/dd.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/devices.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/devices.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/install.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/install.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/jobs.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/jobs.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/mapfile.d.ts +1 -0
- package/dist/safe-bash/opt-in/entrypoints/mapfile.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/read.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/read.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/shuf.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/shuf.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/trap.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/trap.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/truncate.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/truncate.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/yes.d.ts +2 -0
- package/dist/safe-bash/opt-in/entrypoints/yes.js +1 -0
- package/dist/safe-bash/opt-in/entrypoints/yq.d.ts +3 -0
- package/dist/safe-bash/opt-in/entrypoints/yq.js +1 -0
- package/dist/safe-bash/opt-in/fs/devices/index.d.ts +8 -0
- package/dist/safe-bash/opt-in/fs/devices/index.js +292 -0
- package/dist/safe-bash/opt-in/optional.d.ts +28 -0
- package/dist/safe-bash/opt-in/optional.js +14 -0
- package/dist/safe-bash/opt-in/shell/extensions/arrays/index.d.ts +2 -0
- package/dist/safe-bash/opt-in/shell/extensions/arrays/index.js +4 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/index.d.ts +2 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/index.js +291 -0
- package/dist/safe-bash/opt-in/shell/extensions/jobs/state.js +374 -0
- package/dist/safe-bash/opt-in/shell/extensions/mapfile/index.d.ts +24 -0
- package/dist/safe-bash/opt-in/shell/extensions/mapfile/index.js +338 -0
- package/dist/safe-bash/opt-in/shell/extensions/read/index.d.ts +5 -0
- package/dist/safe-bash/opt-in/shell/extensions/read/index.js +351 -0
- package/dist/safe-bash/opt-in/shell/extensions/trap/index.d.ts +9 -0
- package/dist/safe-bash/opt-in/shell/extensions/trap/index.js +210 -0
- package/dist/safe-bash/optional-host.d.ts +5 -0
- package/dist/safe-bash/optional-host.d.ts.map +1 -0
- package/dist/safe-bash/optional-host.js +3 -0
- package/dist/safe-bash/optional-host.js.map +1 -0
- package/dist/safe-bash/shell/arrays/bindings.d.ts +15 -5
- package/dist/safe-bash/shell/arrays/bindings.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/bindings.js +131 -23
- package/dist/safe-bash/shell/arrays/bindings.js.map +1 -1
- package/dist/safe-bash/shell/arrays/ledger.d.ts +1 -0
- package/dist/safe-bash/shell/arrays/ledger.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/ledger.js +19 -0
- package/dist/safe-bash/shell/arrays/ledger.js.map +1 -1
- package/dist/safe-bash/shell/arrays/state.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/state.js +3 -1
- package/dist/safe-bash/shell/arrays/state.js.map +1 -1
- package/dist/safe-bash/shell/arrays/syntax.d.ts +4 -1
- package/dist/safe-bash/shell/arrays/syntax.d.ts.map +1 -1
- package/dist/safe-bash/shell/arrays/syntax.js +3 -3
- package/dist/safe-bash/shell/arrays/syntax.js.map +1 -1
- package/dist/safe-bash/shell/conditional.js +1 -1
- package/dist/safe-bash/shell/descriptors.d.ts +31 -0
- package/dist/safe-bash/shell/descriptors.d.ts.map +1 -0
- package/dist/safe-bash/shell/descriptors.js +234 -0
- package/dist/safe-bash/shell/descriptors.js.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.d.ts +2 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.d.ts.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.js +717 -0
- package/dist/safe-bash/shell/diagnostic-name-ranges.js.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name.d.ts +3 -0
- package/dist/safe-bash/shell/diagnostic-name.d.ts.map +1 -0
- package/dist/safe-bash/shell/diagnostic-name.js +89 -0
- package/dist/safe-bash/shell/diagnostic-name.js.map +1 -0
- package/dist/safe-bash/shell/display.js +1 -1
- package/dist/safe-bash/shell/display.js.map +1 -1
- package/dist/safe-bash/shell/extensions.d.ts +188 -0
- package/dist/safe-bash/shell/extensions.d.ts.map +1 -0
- package/dist/safe-bash/shell/extensions.js +141 -0
- package/dist/safe-bash/shell/extensions.js.map +1 -0
- package/dist/safe-bash/shell/input.d.ts +66 -14
- package/dist/safe-bash/shell/input.d.ts.map +1 -1
- package/dist/safe-bash/shell/input.js +947 -173
- package/dist/safe-bash/shell/input.js.map +1 -1
- package/dist/safe-bash/shell/parser.d.ts +38 -6
- package/dist/safe-bash/shell/parser.d.ts.map +1 -1
- package/dist/safe-bash/shell/parser.js +339 -52
- package/dist/safe-bash/shell/parser.js.map +1 -1
- package/dist/safe-bash/shell/runtime.d.ts +92 -20
- package/dist/safe-bash/shell/runtime.d.ts.map +1 -1
- package/dist/safe-bash/shell/runtime.js +2547 -689
- package/dist/safe-bash/shell/runtime.js.map +1 -1
- package/dist/safe-bash/shell/shell.d.ts.map +1 -1
- package/dist/safe-bash/shell/shell.js +52 -21
- package/dist/safe-bash/shell/shell.js.map +1 -1
- package/dist/safe-bash/shell/types.d.ts +4 -0
- package/dist/safe-bash/shell/types.d.ts.map +1 -1
- package/dist/safe-bash/shell/types.js.map +1 -1
- package/package.json +92 -4
- package/dist/safe-bash/chunks/chunk-3BZ5NQ73.js.map +0 -7
- package/dist/safe-bash/chunks/chunk-4DBWBEU7.js +0 -194
- package/dist/safe-bash/chunks/chunk-4DBWBEU7.js.map +0 -7
- package/dist/safe-bash/chunks/chunk-CXMIIXJA.js +0 -178
- package/dist/safe-bash/chunks/chunk-CXMIIXJA.js.map +0 -7
- package/dist/safe-bash/chunks/chunk-K7W6Q6FN.js.map +0 -7
- /package/dist/safe-bash/chunks/{bz2-B2RXT4EX.js.map → bz2-ACU4EOVE.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-RNKTWFEM.js.map → chunk-CDBQXRWL.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-AFH57PPL.js.map → chunk-IEKESMO4.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-DPJWEGIX.js.map → chunk-JLBIUYT3.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-PVJJFCGA.js.map → chunk-M3GPCYSP.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-2KL6W6NB.js.map → chunk-O2EVBRKF.js.map} +0 -0
- /package/dist/safe-bash/chunks/{chunk-C7QNJ3D4.js.map → chunk-WYTI64IU.js.map} +0 -0
- /package/dist/safe-bash/chunks/{xz-AVXFDXW4.js.map → xz-U4QDTPZL.js.map} +0 -0
- /package/dist/safe-bash/chunks/{zstd-R6RPHJYO.js.map → zstd-OG5RPYXO.js.map} +0 -0
package/dist/safe-bash/core.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { portableSearchCommands, type PortableSearchOptions } from "./commands/s
|
|
|
17
17
|
export * from "./commands/bytes/index.js";
|
|
18
18
|
export * from "./commands/diff-patch/index.js";
|
|
19
19
|
export * from "./commands/safejs/index.js";
|
|
20
|
+
export * from "./commands/python/index.js";
|
|
20
21
|
export * from "./commands/node/browser.js";
|
|
21
22
|
export * from "./commands/network/public.js";
|
|
22
23
|
export * from "./commands/llm/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAChM,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,C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AAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC"}
|
package/dist/safe-bash/core.js
CHANGED
|
@@ -17,6 +17,7 @@ export { portableSearchCommands } from "./commands/search/portable.js";
|
|
|
17
17
|
export * from "./commands/bytes/index.js";
|
|
18
18
|
export * from "./commands/diff-patch/index.js";
|
|
19
19
|
export * from "./commands/safejs/index.js";
|
|
20
|
+
export * from "./commands/python/index.js";
|
|
20
21
|
export * from "./commands/node/browser.js";
|
|
21
22
|
export * from "./commands/network/public.js";
|
|
22
23
|
export * from "./commands/llm/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE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A2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { InputError, observe, Session } from "./io.js";
|
|
2
|
+
import { integerMaximum, quote } from "./options.js";
|
|
3
|
+
import { yieldTurn } from "@poe-platform/safe-bash/contracts/yield";
|
|
4
|
+
function displayByte(byte) {
|
|
5
|
+
const high = byte >= 128;
|
|
6
|
+
const value = high ? byte - 128 : byte;
|
|
7
|
+
return `${high ? "M-" : ""}${value < 32 ? `^${String.fromCharCode(value + 64)}` : value === 127 ? "^?" : String.fromCharCode(value)}`;
|
|
8
|
+
}
|
|
9
|
+
function remaining(input, skip) {
|
|
10
|
+
if (input.stat?.type !== "file" || !Number.isSafeInteger(input.stat.size) || input.stat.size < 0)
|
|
11
|
+
return undefined;
|
|
12
|
+
const size = BigInt(input.stat.size);
|
|
13
|
+
return skip < size ? size - skip : 0n;
|
|
14
|
+
}
|
|
15
|
+
export async function compare(session, args) {
|
|
16
|
+
const left = await session.open(args.files[0]);
|
|
17
|
+
if (args.files[0] === args.files[1] && (args.files[0] === "-" || args.skips[0] === args.skips[1] && args.skips[0] <= integerMaximum))
|
|
18
|
+
return 0;
|
|
19
|
+
const right = await session.open(args.files[1]);
|
|
20
|
+
if (left.path !== undefined && right.path !== undefined && args.skips[0] === args.skips[1] && args.skips[0] <= integerMaximum
|
|
21
|
+
&& session.context.fs.compareEntry && await observe(() => session.context.fs.compareEntry(left.path, session.context.fs, right.path, { signal: session.signal }), session.signal) === "same")
|
|
22
|
+
return 0;
|
|
23
|
+
const sizes = [remaining(left, args.skips[0]), remaining(right, args.skips[1])];
|
|
24
|
+
if (args.mode === "silent" && sizes[0] !== undefined && sizes[1] !== undefined && sizes[0] !== sizes[1]
|
|
25
|
+
&& (sizes[0] < sizes[1] ? sizes[0] : sizes[1]) < args.count)
|
|
26
|
+
return 1;
|
|
27
|
+
const comparisonBlockBytes = session.comparisonBlockBytes ?? left.stat?.ioBlockSize ?? 65536;
|
|
28
|
+
if (!Number.isSafeInteger(comparisonBlockBytes) || comparisonBlockBytes < 1) {
|
|
29
|
+
throw new InputError(left.name, new Error("invalid preferred I/O block size"), false);
|
|
30
|
+
}
|
|
31
|
+
let maximum = args.count;
|
|
32
|
+
for (const size of sizes)
|
|
33
|
+
if (size !== undefined && size < maximum)
|
|
34
|
+
maximum = size;
|
|
35
|
+
const width = maximum.toString().length;
|
|
36
|
+
const inputs = [left, right];
|
|
37
|
+
const cursors = inputs.map((input, index) => session.cursor(input, args.skips[index]));
|
|
38
|
+
for (let index = 0; index < 2; index++) {
|
|
39
|
+
const skip = args.skips[index];
|
|
40
|
+
if (skip > integerMaximum && inputs[index].stat?.type !== "file")
|
|
41
|
+
throw new InputError(inputs[index].name, new Error("Value too large to be stored in data type"), false);
|
|
42
|
+
if (inputs[index].path === undefined || session.context.fs.readStream && (inputs[index].stat?.type !== "file" || inputs[index].stat.size < 0))
|
|
43
|
+
await cursors[index].skip(skip);
|
|
44
|
+
if (inputs[index].stat?.type === "directory")
|
|
45
|
+
await cursors[index].available();
|
|
46
|
+
}
|
|
47
|
+
let compared = 0n, line = 1n, atLineStart = true, work = 0;
|
|
48
|
+
while (true) {
|
|
49
|
+
const remaining = args.count - compared;
|
|
50
|
+
const requested = Number(remaining < BigInt(comparisonBlockBytes) ? remaining : BigInt(comparisonBlockBytes));
|
|
51
|
+
const first = await cursors[0].block(requested), second = await cursors[1].block(requested);
|
|
52
|
+
const count = Math.min(first.length, second.length);
|
|
53
|
+
let different = false, output = "";
|
|
54
|
+
for (let offset = 0; offset < count; offset++) {
|
|
55
|
+
const byteLeft = first[offset], byteRight = second[offset];
|
|
56
|
+
compared++;
|
|
57
|
+
if (byteLeft !== byteRight) {
|
|
58
|
+
different = true;
|
|
59
|
+
if (args.mode === "silent")
|
|
60
|
+
return 1;
|
|
61
|
+
const octalLeft = byteLeft.toString(8).padStart(3, " "), octalRight = byteRight.toString(8).padStart(3, " ");
|
|
62
|
+
if (args.mode === "first") {
|
|
63
|
+
await session.output(`${left.name} ${right.name} differ: ${args.printBytes ? "byte" : "char"} ${compared}, line ${line}${args.printBytes ? ` is ${octalLeft} ${displayByte(byteLeft)} ${octalRight} ${displayByte(byteRight)}` : ""}\n`);
|
|
64
|
+
return 1;
|
|
65
|
+
}
|
|
66
|
+
output += `${compared.toString().padStart(width, " ")} ${octalLeft} ${args.printBytes ? `${displayByte(byteLeft).padEnd(4, " ")} ` : ""}${octalRight}${args.printBytes ? ` ${displayByte(byteRight)}` : ""}\n`;
|
|
67
|
+
if (output.length >= 16384) {
|
|
68
|
+
await session.output(output);
|
|
69
|
+
output = "";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (byteLeft === 10)
|
|
73
|
+
line++;
|
|
74
|
+
atLineStart = byteLeft === 10;
|
|
75
|
+
}
|
|
76
|
+
if (output)
|
|
77
|
+
await session.output(output);
|
|
78
|
+
if (first.length !== second.length) {
|
|
79
|
+
if (args.mode !== "silent") {
|
|
80
|
+
const name = first.length < second.length ? left.name : right.name;
|
|
81
|
+
const extra = compared === 0n ? "which is empty" : args.mode === "all" ? `after byte ${compared}`
|
|
82
|
+
: `after byte ${compared}, ${atLineStart ? "line" : "in line"} ${atLineStart ? line - 1n : line}`;
|
|
83
|
+
await session.output(`cmp: EOF on ${quote(name)} ${extra}\n`, true);
|
|
84
|
+
}
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
if (first.length !== comparisonBlockBytes)
|
|
88
|
+
return different ? 1 : 0;
|
|
89
|
+
work += count;
|
|
90
|
+
if (work >= 65536) {
|
|
91
|
+
await yieldTurn(session.signal);
|
|
92
|
+
work = 0;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CommandDefinition, type VirtualShellPlugin } from "@poe-platform/safe-bash/contracts/index";
|
|
2
|
+
import { type CmpCommandsOptions } from "./options.js";
|
|
3
|
+
export type { CmpCommandsOptions, CmpLimits } from "./options.js";
|
|
4
|
+
export declare function createCmpCommand(options?: CmpCommandsOptions): CommandDefinition;
|
|
5
|
+
export declare function createCmpCommands(options?: CmpCommandsOptions): readonly CommandDefinition[];
|
|
6
|
+
export declare function cmpCommands(options?: CmpCommandsOptions): VirtualShellPlugin;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { commandRuntimeIdentity } from "@poe-platform/safe-bash/contracts/index";
|
|
2
|
+
import { compare } from "./compare.js";
|
|
3
|
+
import { errorText, InputError, inputDiagnostic, Session } from "./io.js";
|
|
4
|
+
import { limitsFor, parseArguments, UsageError } from "./options.js";
|
|
5
|
+
export function createCmpCommand(options = {}) {
|
|
6
|
+
const limits = limitsFor(options);
|
|
7
|
+
const comparisonBlockBytes = options.comparisonBlockBytes;
|
|
8
|
+
if (comparisonBlockBytes !== undefined && (!Number.isSafeInteger(comparisonBlockBytes) || comparisonBlockBytes < 1)) {
|
|
9
|
+
throw new RangeError("cmp comparisonBlockBytes must be a positive safe integer");
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
name: "cmp", runtimeIdentity: commandRuntimeIdentity, description: "Compare two inputs byte by byte",
|
|
13
|
+
async execute(context) {
|
|
14
|
+
context.signal.throwIfAborted();
|
|
15
|
+
const session = new Session(context, limits, comparisonBlockBytes);
|
|
16
|
+
let silent = false, exitCode = 0;
|
|
17
|
+
let failure;
|
|
18
|
+
try {
|
|
19
|
+
const args = parseArguments(context.args, context.env.POSIXLY_CORRECT !== undefined);
|
|
20
|
+
silent = args.mode === "silent";
|
|
21
|
+
if (args.information) {
|
|
22
|
+
await session.output(args.information === "version" ? "cmp (virtual-bash, GNU diffutils 3.12 profile)\n"
|
|
23
|
+
: `Usage: cmp [OPTION]... FILE1 [FILE2 [SKIP1 [SKIP2]]]
|
|
24
|
+
Compare two files byte by byte.
|
|
25
|
+
|
|
26
|
+
The optional SKIP1 and SKIP2 specify the number of bytes to skip
|
|
27
|
+
at the beginning of each file (zero by default).
|
|
28
|
+
|
|
29
|
+
Mandatory arguments to long options are mandatory for short options too.
|
|
30
|
+
-b, --print-bytes print differing bytes
|
|
31
|
+
-i, --ignore-initial=SKIP skip first SKIP bytes of both inputs
|
|
32
|
+
-i, --ignore-initial=SKIP1:SKIP2 skip first SKIP1 bytes of FILE1 and
|
|
33
|
+
first SKIP2 bytes of FILE2
|
|
34
|
+
-l, --verbose output byte numbers and differing byte values
|
|
35
|
+
-n, --bytes=LIMIT compare at most LIMIT bytes
|
|
36
|
+
-s, --quiet, --silent suppress all normal output
|
|
37
|
+
--help display this help and exit
|
|
38
|
+
-v, --version output version information and exit
|
|
39
|
+
|
|
40
|
+
SKIP values may be followed by the following multiplicative suffixes:
|
|
41
|
+
kB 1000, K 1024, MB 1,000,000, M 1,048,576,
|
|
42
|
+
GB 1,000,000,000, G 1,073,741,824, and so on for T, P, E, Z, Y.
|
|
43
|
+
|
|
44
|
+
If a FILE is '-' or missing, read standard input.
|
|
45
|
+
Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
|
|
46
|
+
|
|
47
|
+
Report bugs to: bug-diffutils@gnu.org
|
|
48
|
+
GNU diffutils home page: <https://www.gnu.org/software/diffutils/>
|
|
49
|
+
General help using GNU software: <https://www.gnu.org/gethelp/>
|
|
50
|
+
`);
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
exitCode = await compare(session, args);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
failure = { reason: error };
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
await session.close(false);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
failure ??= { reason: error };
|
|
63
|
+
}
|
|
64
|
+
context.signal.throwIfAborted();
|
|
65
|
+
session.signal.throwIfAborted();
|
|
66
|
+
if (!failure)
|
|
67
|
+
return { exitCode };
|
|
68
|
+
const error = failure.reason;
|
|
69
|
+
if (error instanceof UsageError)
|
|
70
|
+
await session.output(`cmp: ${error.message}\ncmp: Try 'cmp --help' for more information.\n`, true);
|
|
71
|
+
else if (error instanceof InputError) {
|
|
72
|
+
if (!silent || !error.opening)
|
|
73
|
+
await session.output(inputDiagnostic(error), true);
|
|
74
|
+
}
|
|
75
|
+
else
|
|
76
|
+
await session.output(`cmp: ${errorText(error)}\n`, true);
|
|
77
|
+
return { exitCode: 2 };
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export function createCmpCommands(options = {}) {
|
|
82
|
+
return Object.freeze([createCmpCommand(options)]);
|
|
83
|
+
}
|
|
84
|
+
export function cmpCommands(options = {}) {
|
|
85
|
+
const commands = createCmpCommands(options);
|
|
86
|
+
const replace = options.replace ?? false;
|
|
87
|
+
return {
|
|
88
|
+
name: "cmp-commands",
|
|
89
|
+
setup(host) {
|
|
90
|
+
if (!replace)
|
|
91
|
+
for (const command of commands) {
|
|
92
|
+
if (host.commands.has(command.name))
|
|
93
|
+
throw new Error(`Command already registered: ${command.name}`);
|
|
94
|
+
}
|
|
95
|
+
for (const command of commands)
|
|
96
|
+
host.commands.register(command, { replace });
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { FsError, readBytes, resolvePath, writeBytes } from "@poe-platform/safe-bash/contracts/index";
|
|
2
|
+
import { integerMaximum, pathQuote } from "./options.js";
|
|
3
|
+
import { yieldTurn } from "@poe-platform/safe-bash/contracts/yield";
|
|
4
|
+
export async function observe(operation, signal) {
|
|
5
|
+
signal.throwIfAborted();
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const abort = () => { signal.removeEventListener("abort", abort); reject(signal.reason); };
|
|
8
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
9
|
+
Promise.resolve().then(() => { signal.throwIfAborted(); return operation(); }).then(value => {
|
|
10
|
+
signal.removeEventListener("abort", abort);
|
|
11
|
+
resolve(value);
|
|
12
|
+
}, error => {
|
|
13
|
+
signal.removeEventListener("abort", abort);
|
|
14
|
+
reject(error);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export class InputError extends Error {
|
|
19
|
+
operand;
|
|
20
|
+
reason;
|
|
21
|
+
opening;
|
|
22
|
+
constructor(operand, reason, opening) {
|
|
23
|
+
super("cmp input failure");
|
|
24
|
+
this.operand = operand;
|
|
25
|
+
this.reason = reason;
|
|
26
|
+
this.opening = opening;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const errnoMessages = {
|
|
30
|
+
ENOENT: "No such file or directory", EACCES: "Permission denied", EPERM: "Operation not permitted",
|
|
31
|
+
EISDIR: "Is a directory", ENOTDIR: "Not a directory", EIO: "Input/output error", EBADF: "Bad file descriptor",
|
|
32
|
+
ELOOP: "Too many levels of symbolic links", ENAMETOOLONG: "File name too long", ENOSPC: "No space left on device",
|
|
33
|
+
EMFILE: "Too many open files", ENFILE: "Too many open files in system", EPIPE: "Broken pipe",
|
|
34
|
+
EOVERFLOW: "Value too large to be stored in data type", ENOTSUP: "Operation not supported", EFBIG: "File too large",
|
|
35
|
+
};
|
|
36
|
+
export function errorText(error) {
|
|
37
|
+
if (error instanceof FsError)
|
|
38
|
+
return errnoMessages[error.code] ?? error.message;
|
|
39
|
+
return error instanceof Error ? error.message : String(error);
|
|
40
|
+
}
|
|
41
|
+
export class Cursor {
|
|
42
|
+
operand;
|
|
43
|
+
signal;
|
|
44
|
+
maxChunkBytes;
|
|
45
|
+
reader;
|
|
46
|
+
chunk = new Uint8Array();
|
|
47
|
+
offset = 0;
|
|
48
|
+
done = false;
|
|
49
|
+
closed;
|
|
50
|
+
returned;
|
|
51
|
+
untilYield = 65536;
|
|
52
|
+
constructor(operand, source, signal, maxChunkBytes) {
|
|
53
|
+
this.operand = operand;
|
|
54
|
+
this.signal = signal;
|
|
55
|
+
this.maxChunkBytes = maxChunkBytes;
|
|
56
|
+
this.reader = readBytes({
|
|
57
|
+
[Symbol.asyncIterator]: () => {
|
|
58
|
+
const iterator = source[Symbol.asyncIterator]();
|
|
59
|
+
return {
|
|
60
|
+
next: () => iterator.next(),
|
|
61
|
+
return: () => {
|
|
62
|
+
this.returned ??= Promise.resolve().then(() => iterator.return ? iterator.return() : { value: undefined, done: true });
|
|
63
|
+
return this.returned;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
}, signal);
|
|
68
|
+
}
|
|
69
|
+
async available() {
|
|
70
|
+
try {
|
|
71
|
+
this.signal.throwIfAborted();
|
|
72
|
+
while (!this.done && this.offset === this.chunk.length) {
|
|
73
|
+
if (this.untilYield <= 0) {
|
|
74
|
+
await yieldTurn(this.signal);
|
|
75
|
+
this.untilYield = 65536;
|
|
76
|
+
}
|
|
77
|
+
const next = await this.reader.next();
|
|
78
|
+
this.done = Boolean(next.done);
|
|
79
|
+
if (next.done) {
|
|
80
|
+
this.chunk = new Uint8Array();
|
|
81
|
+
this.offset = 0;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
if (next.value.byteLength > this.maxChunkBytes)
|
|
85
|
+
throw new Error("input chunk bytes limit exceeded");
|
|
86
|
+
this.untilYield -= Math.max(64, next.value.byteLength);
|
|
87
|
+
this.chunk = new Uint8Array(next.value);
|
|
88
|
+
this.offset = 0;
|
|
89
|
+
}
|
|
90
|
+
return this.chunk.subarray(this.offset);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
this.signal.throwIfAborted();
|
|
94
|
+
throw new InputError(this.operand, error, false);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
consume(count) { this.offset += count; }
|
|
98
|
+
async block(count) {
|
|
99
|
+
const bytes = new Uint8Array(count);
|
|
100
|
+
let size = 0;
|
|
101
|
+
while (size < count) {
|
|
102
|
+
const chunk = await this.available();
|
|
103
|
+
if (!chunk.length)
|
|
104
|
+
break;
|
|
105
|
+
const length = Math.min(count - size, chunk.length);
|
|
106
|
+
bytes.set(chunk.subarray(0, length), size);
|
|
107
|
+
this.consume(length);
|
|
108
|
+
size += length;
|
|
109
|
+
}
|
|
110
|
+
return bytes.subarray(0, size);
|
|
111
|
+
}
|
|
112
|
+
async skip(count) {
|
|
113
|
+
while (count > 0n) {
|
|
114
|
+
const chunk = await this.available();
|
|
115
|
+
if (!chunk.length)
|
|
116
|
+
break;
|
|
117
|
+
const amount = Number(count < BigInt(chunk.length) ? count : BigInt(chunk.length));
|
|
118
|
+
this.consume(amount);
|
|
119
|
+
count -= BigInt(amount);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
close() {
|
|
123
|
+
this.closed ??= (async () => {
|
|
124
|
+
try {
|
|
125
|
+
await this.reader.return(undefined);
|
|
126
|
+
await this.returned;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
throw new InputError(this.operand, error, false);
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
this.chunk = new Uint8Array();
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
135
|
+
return this.closed;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export class Session {
|
|
139
|
+
context;
|
|
140
|
+
limits;
|
|
141
|
+
comparisonBlockBytes;
|
|
142
|
+
controller = new AbortController();
|
|
143
|
+
signal;
|
|
144
|
+
cursors = [];
|
|
145
|
+
closed;
|
|
146
|
+
constructor(context, limits, comparisonBlockBytes) {
|
|
147
|
+
this.context = context;
|
|
148
|
+
this.limits = limits;
|
|
149
|
+
this.comparisonBlockBytes = comparisonBlockBytes;
|
|
150
|
+
this.signal = AbortSignal.any([context.signal, this.controller.signal]);
|
|
151
|
+
context.registerCleanup?.(() => this.close());
|
|
152
|
+
}
|
|
153
|
+
async open(name) {
|
|
154
|
+
this.signal.throwIfAborted();
|
|
155
|
+
if (name === "-")
|
|
156
|
+
return { name };
|
|
157
|
+
try {
|
|
158
|
+
if (!name)
|
|
159
|
+
throw new FsError("ENOENT");
|
|
160
|
+
const path = resolvePath(this.context.cwd, name);
|
|
161
|
+
const stat = await observe(() => this.context.fs.stat(path, { signal: this.signal }), this.signal);
|
|
162
|
+
this.signal.throwIfAborted();
|
|
163
|
+
await observe(() => this.context.fs.access(path, 4, { signal: this.signal }), this.signal);
|
|
164
|
+
this.signal.throwIfAborted();
|
|
165
|
+
return { name, path, stat };
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
this.signal.throwIfAborted();
|
|
169
|
+
throw new InputError(name, error, true);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
cursor(input, skip) {
|
|
173
|
+
this.signal.throwIfAborted();
|
|
174
|
+
const { context, signal, limits } = this;
|
|
175
|
+
const source = input.path === undefined ? context.stdin : (async function* () {
|
|
176
|
+
if (input.stat?.type === "directory")
|
|
177
|
+
throw new FsError("EISDIR");
|
|
178
|
+
if (skip > integerMaximum && input.stat?.type === "file")
|
|
179
|
+
return;
|
|
180
|
+
if (context.fs.readStream) {
|
|
181
|
+
const start = input.stat?.type === "file" && input.stat.size >= 0 ? Number(skip < BigInt(Number.MAX_SAFE_INTEGER) ? skip : BigInt(Number.MAX_SAFE_INTEGER)) : 0;
|
|
182
|
+
yield* context.fs.readStream(input.path, { signal, start, chunkSize: Math.min(65536, limits.maxChunkBytes) });
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
if (!input.stat || !Number.isSafeInteger(input.stat.size) || input.stat.size < 0 || input.stat.size > limits.maxFallbackBytes) {
|
|
186
|
+
throw new Error("bounded comparison requires readStream or a file within maxFallbackBytes");
|
|
187
|
+
}
|
|
188
|
+
const bytes = await observe(() => context.fs.readFile(input.path, { signal, maxBytes: limits.maxFallbackBytes }), signal);
|
|
189
|
+
if (bytes.length > limits.maxFallbackBytes)
|
|
190
|
+
throw new Error("input fallback bytes limit exceeded");
|
|
191
|
+
for (let offset = Number(skip < BigInt(bytes.length) ? skip : BigInt(bytes.length)); offset < bytes.length; offset += limits.maxChunkBytes)
|
|
192
|
+
yield bytes.subarray(offset, offset + limits.maxChunkBytes);
|
|
193
|
+
}
|
|
194
|
+
})();
|
|
195
|
+
const cursor = new Cursor(input.name, source, signal, limits.maxChunkBytes);
|
|
196
|
+
this.cursors.push(cursor);
|
|
197
|
+
return cursor;
|
|
198
|
+
}
|
|
199
|
+
async output(text, stderr = false) {
|
|
200
|
+
await writeBytes(stderr ? this.context.stderr : this.context.stdout, new TextEncoder().encode(text), this.signal);
|
|
201
|
+
}
|
|
202
|
+
close(cancel = true) {
|
|
203
|
+
if (!this.closed) {
|
|
204
|
+
this.closed = Promise.resolve().then(async () => {
|
|
205
|
+
const results = await Promise.allSettled(this.cursors.map(cursor => cursor.close()));
|
|
206
|
+
const failure = results.find(result => result.status === "rejected");
|
|
207
|
+
if (failure?.status === "rejected")
|
|
208
|
+
throw failure.reason;
|
|
209
|
+
});
|
|
210
|
+
if (cancel)
|
|
211
|
+
this.controller.abort(new Error("cmp invocation closed"));
|
|
212
|
+
}
|
|
213
|
+
return this.closed;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
export function inputDiagnostic(error) {
|
|
217
|
+
return `cmp: ${pathQuote(error.operand)}: ${errorText(error.reason)}\n`;
|
|
218
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface CmpLimits {
|
|
2
|
+
readonly maxChunkBytes: number;
|
|
3
|
+
readonly maxFallbackBytes: number;
|
|
4
|
+
}
|
|
5
|
+
export interface CmpCommandsOptions {
|
|
6
|
+
readonly replace?: boolean;
|
|
7
|
+
readonly comparisonBlockBytes?: number;
|
|
8
|
+
readonly limits?: Partial<CmpLimits>;
|
|
9
|
+
}
|
|
10
|
+
export declare const integerMaximum = 9223372036854775807n;
|
|
11
|
+
export interface CmpArguments {
|
|
12
|
+
readonly files: readonly [string, string];
|
|
13
|
+
readonly skips: readonly [bigint, bigint];
|
|
14
|
+
readonly count: bigint;
|
|
15
|
+
readonly mode: "first" | "all" | "silent";
|
|
16
|
+
readonly printBytes: boolean;
|
|
17
|
+
readonly information?: "help" | "version";
|
|
18
|
+
}
|
|
19
|
+
export declare class UsageError extends Error {
|
|
20
|
+
}
|
|
21
|
+
export declare function quote(value: string): string;
|
|
22
|
+
export declare function pathQuote(value: string): string;
|
|
23
|
+
export declare function parseArguments(args: readonly string[], posix: boolean): CmpArguments;
|
|
24
|
+
export declare function limitsFor(options: CmpCommandsOptions): CmpLimits;
|