buninu 0.1.1
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/.bashrc +11 -0
- package/ARCHITECTURE.md +452 -0
- package/LICENSE +21 -0
- package/README.md +121 -0
- package/apps/bun/make-bunBin.sh +84 -0
- package/apps/jsgotty/LICENSE +23 -0
- package/apps/jsgotty/LICENSES/Apache-2.0-zmodem.js.txt +201 -0
- package/apps/jsgotty/NOTICE +21 -0
- package/apps/jsgotty/README.en.md +290 -0
- package/apps/jsgotty/README.md +292 -0
- package/apps/jsgotty/client.mjs +700 -0
- package/apps/jsgotty/env.sh +2 -0
- package/apps/jsgotty/gotty.js +3325 -0
- package/apps/jsgotty/node_modules/.package-lock.json +35 -0
- package/apps/jsgotty/node_modules/node-addon-api/LICENSE.md +9 -0
- package/apps/jsgotty/node_modules/node-addon-api/README.md +319 -0
- package/apps/jsgotty/node_modules/node-addon-api/common.gypi +20 -0
- package/apps/jsgotty/node_modules/node-addon-api/except.gypi +25 -0
- package/apps/jsgotty/node_modules/node-addon-api/index.js +12 -0
- package/apps/jsgotty/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
- package/apps/jsgotty/node_modules/node-addon-api/napi-inl.h +6607 -0
- package/apps/jsgotty/node_modules/node-addon-api/napi.h +3201 -0
- package/apps/jsgotty/node_modules/node-addon-api/node_addon_api.gyp +32 -0
- package/apps/jsgotty/node_modules/node-addon-api/node_api.gyp +9 -0
- package/apps/jsgotty/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/apps/jsgotty/node_modules/node-addon-api/nothing.c +0 -0
- package/apps/jsgotty/node_modules/node-addon-api/package-support.json +21 -0
- package/apps/jsgotty/node_modules/node-addon-api/package.json +480 -0
- package/apps/jsgotty/node_modules/node-addon-api/tools/README.md +73 -0
- package/apps/jsgotty/node_modules/node-addon-api/tools/check-napi.js +99 -0
- package/apps/jsgotty/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/apps/jsgotty/node_modules/node-addon-api/tools/conversion.js +301 -0
- package/apps/jsgotty/node_modules/node-addon-api/tools/eslint-format.js +79 -0
- package/apps/jsgotty/node_modules/ws/LICENSE +20 -0
- package/apps/jsgotty/node_modules/ws/README.md +548 -0
- package/apps/jsgotty/node_modules/ws/browser.js +8 -0
- package/apps/jsgotty/node_modules/ws/index.js +22 -0
- package/apps/jsgotty/node_modules/ws/lib/buffer-util.js +131 -0
- package/apps/jsgotty/node_modules/ws/lib/constants.js +19 -0
- package/apps/jsgotty/node_modules/ws/lib/event-target.js +292 -0
- package/apps/jsgotty/node_modules/ws/lib/extension.js +203 -0
- package/apps/jsgotty/node_modules/ws/lib/limiter.js +55 -0
- package/apps/jsgotty/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/apps/jsgotty/node_modules/ws/lib/receiver.js +760 -0
- package/apps/jsgotty/node_modules/ws/lib/sender.js +607 -0
- package/apps/jsgotty/node_modules/ws/lib/stream.js +161 -0
- package/apps/jsgotty/node_modules/ws/lib/subprotocol.js +62 -0
- package/apps/jsgotty/node_modules/ws/lib/validation.js +152 -0
- package/apps/jsgotty/node_modules/ws/lib/websocket-server.js +562 -0
- package/apps/jsgotty/node_modules/ws/lib/websocket.js +1407 -0
- package/apps/jsgotty/node_modules/ws/package.json +70 -0
- package/apps/jsgotty/node_modules/ws/wrapper.mjs +21 -0
- package/apps/jsgotty/package-lock.json +46 -0
- package/apps/jsgotty/package.json +13 -0
- package/apps/jsgotty/patches/windowsPtyAgent.js +326 -0
- package/apps/jsgotty/patches/windowsTerminal.js +204 -0
- package/apps/jsgotty/rz.js +199 -0
- package/apps/jsgotty/single-exe/README.md +80 -0
- package/apps/jsgotty/single-exe/assetsHelper.js +90 -0
- package/apps/jsgotty/single-exe/assetsLoader.mjs +85 -0
- package/apps/jsgotty/single-exe/compiled.js +138 -0
- package/apps/jsgotty/single-exe/entry.mjs +9 -0
- package/apps/jsgotty/single-exe/packAssets.sh +7 -0
- package/apps/jsgotty/static/css/index.css +13 -0
- package/apps/jsgotty/static/css/kitty.css +61 -0
- package/apps/jsgotty/static/css/xterm.css +218 -0
- package/apps/jsgotty/static/css/xterm_customize.css +32 -0
- package/apps/jsgotty/static/favicon.ico +0 -0
- package/apps/jsgotty/static/help.md +125 -0
- package/apps/jsgotty/static/icon.svg +66 -0
- package/apps/jsgotty/static/icon_192.png +0 -0
- package/apps/jsgotty/static/index.html +164 -0
- package/apps/jsgotty/static/js/gotty.js +31537 -0
- package/apps/jsgotty/static/js/gotty.js.LICENSE.txt +7 -0
- package/apps/jsgotty/static/js/gotty.js.map +1 -0
- package/apps/jsgotty/static/js/gotty.licenses.txt +650 -0
- package/apps/jsgotty/static/js/kitty.js +1045 -0
- package/apps/jsgotty/static/js/windows_bridge.js +194 -0
- package/apps/jsgotty/static/js/xterm-addon-unicode11.js +2 -0
- package/apps/jsgotty/static/js/zmodem.js +1 -0
- package/apps/jsgotty/static/manifest.json +15 -0
- package/apps/jsgotty/sz.js +273 -0
- package/apps/jsgotty/tests/kitty-order.test.js +58 -0
- package/apps/jsgotty/viu.mjs +393 -0
- package/apps/jsgotty/wgotty +62 -0
- package/apps/jsgotty/windows-bridge-node.js +60 -0
- package/apps/jsgotty/zmodem-node.js +260 -0
- package/apps/jsmdcui/CHANGELOG.md +1048 -0
- package/apps/jsmdcui/LICENSE +22 -0
- package/apps/jsmdcui/README.md +1269 -0
- package/apps/jsmdcui/cdp-maze.js +141 -0
- package/apps/jsmdcui/clean.sh +9 -0
- package/apps/jsmdcui/demos/basic.jpg +0 -0
- package/apps/jsmdcui/demos/chinese.md +32 -0
- package/apps/jsmdcui/demos/event.md +170 -0
- package/apps/jsmdcui/demos/good.jpg +0 -0
- package/apps/jsmdcui/demos/image-processor.md +366 -0
- package/apps/jsmdcui/demos/image-processor.zh-TW.md +366 -0
- package/apps/jsmdcui/demos/img-change.md +73 -0
- package/apps/jsmdcui/demos/imgtool-zh.md +298 -0
- package/apps/jsmdcui/demos/imgtool.md +298 -0
- package/apps/jsmdcui/demos/maze.md +149 -0
- package/apps/jsmdcui/demos/reactive.md +40 -0
- package/apps/jsmdcui/demos/reader.md +513 -0
- package/apps/jsmdcui/demos/select.md +63 -0
- package/apps/jsmdcui/demos/todo-zh.md +190 -0
- package/apps/jsmdcui/demos/todo.md +191 -0
- package/apps/jsmdcui/edit +9 -0
- package/apps/jsmdcui/jsmdcui.sh +5 -0
- package/apps/jsmdcui/llm-maze.txt +94 -0
- package/apps/jsmdcui/package.json +19 -0
- package/apps/jsmdcui/project_structure.txt +35 -0
- package/apps/jsmdcui/runmd.mjs +1140 -0
- package/apps/jsmdcui/runtime/colorschemes/atom-dark.micro +33 -0
- package/apps/jsmdcui/runtime/colorschemes/bubblegum.micro +31 -0
- package/apps/jsmdcui/runtime/colorschemes/cmc-16.micro +47 -0
- package/apps/jsmdcui/runtime/colorschemes/cmc-tc.micro +43 -0
- package/apps/jsmdcui/runtime/colorschemes/darcula.micro +34 -0
- package/apps/jsmdcui/runtime/colorschemes/default.micro +1 -0
- package/apps/jsmdcui/runtime/colorschemes/dracula-tc.micro +49 -0
- package/apps/jsmdcui/runtime/colorschemes/dukedark-tc.micro +38 -0
- package/apps/jsmdcui/runtime/colorschemes/dukelight-tc.micro +38 -0
- package/apps/jsmdcui/runtime/colorschemes/dukeubuntu-tc.micro +38 -0
- package/apps/jsmdcui/runtime/colorschemes/geany.micro +29 -0
- package/apps/jsmdcui/runtime/colorschemes/gotham.micro +29 -0
- package/apps/jsmdcui/runtime/colorschemes/gruvbox-tc.micro +29 -0
- package/apps/jsmdcui/runtime/colorschemes/gruvbox.micro +26 -0
- package/apps/jsmdcui/runtime/colorschemes/material-tc.micro +36 -0
- package/apps/jsmdcui/runtime/colorschemes/monokai-dark.micro +28 -0
- package/apps/jsmdcui/runtime/colorschemes/monokai.micro +34 -0
- package/apps/jsmdcui/runtime/colorschemes/one-dark.micro +39 -0
- package/apps/jsmdcui/runtime/colorschemes/railscast.micro +37 -0
- package/apps/jsmdcui/runtime/colorschemes/simple.micro +33 -0
- package/apps/jsmdcui/runtime/colorschemes/solarized-tc.micro +31 -0
- package/apps/jsmdcui/runtime/colorschemes/solarized.micro +30 -0
- package/apps/jsmdcui/runtime/colorschemes/sunny-day.micro +29 -0
- package/apps/jsmdcui/runtime/colorschemes/twilight.micro +40 -0
- package/apps/jsmdcui/runtime/colorschemes/zenburn.micro +30 -0
- package/apps/jsmdcui/runtime/help/actions.md +161 -0
- package/apps/jsmdcui/runtime/help/cdp.md +124 -0
- package/apps/jsmdcui/runtime/help/colors.md +421 -0
- package/apps/jsmdcui/runtime/help/commands.md +161 -0
- package/apps/jsmdcui/runtime/help/copypaste.md +149 -0
- package/apps/jsmdcui/runtime/help/defaultkeys.md +148 -0
- package/apps/jsmdcui/runtime/help/help.md +1269 -0
- package/apps/jsmdcui/runtime/help/keybindings.md +355 -0
- package/apps/jsmdcui/runtime/help/linter.md +90 -0
- package/apps/jsmdcui/runtime/help/options.md +709 -0
- package/apps/jsmdcui/runtime/help/plugins.md +544 -0
- package/apps/jsmdcui/runtime/help/tutorial.md +112 -0
- package/apps/jsmdcui/runtime/jsplugins/cdp/cdp-server.js +1185 -0
- package/apps/jsmdcui/runtime/jsplugins/cdp/cdp.js +201 -0
- package/apps/jsmdcui/runtime/jsplugins/chapter/chapter.js +111 -0
- package/apps/jsmdcui/runtime/jsplugins/diff/diff.js +46 -0
- package/apps/jsmdcui/runtime/jsplugins/example/example.js +117 -0
- package/apps/jsmdcui/runtime/jsplugins/linter/linter.js +281 -0
- package/apps/jsmdcui/runtime/plugins/autoclose/autoclose.lua +75 -0
- package/apps/jsmdcui/runtime/plugins/ftoptions/ftoptions.lua +17 -0
- package/apps/jsmdcui/runtime/plugins/literate/README.md +5 -0
- package/apps/jsmdcui/runtime/plugins/literate/literate.lua +55 -0
- package/apps/jsmdcui/runtime/plugins/status/help/status.md +21 -0
- package/apps/jsmdcui/runtime/plugins/status/status.lua +62 -0
- package/apps/jsmdcui/runtime/syntax/LICENSE +22 -0
- package/apps/jsmdcui/runtime/syntax/PowerShell.yaml +128 -0
- package/apps/jsmdcui/runtime/syntax/README.md +63 -0
- package/apps/jsmdcui/runtime/syntax/ada.yaml +43 -0
- package/apps/jsmdcui/runtime/syntax/apacheconf.yaml +59 -0
- package/apps/jsmdcui/runtime/syntax/arduino.yaml +101 -0
- package/apps/jsmdcui/runtime/syntax/asciidoc.yaml +51 -0
- package/apps/jsmdcui/runtime/syntax/asm.yaml +123 -0
- package/apps/jsmdcui/runtime/syntax/ats.yaml +99 -0
- package/apps/jsmdcui/runtime/syntax/awk.yaml +44 -0
- package/apps/jsmdcui/runtime/syntax/b.yaml +87 -0
- package/apps/jsmdcui/runtime/syntax/bat.yaml +57 -0
- package/apps/jsmdcui/runtime/syntax/c.yaml +60 -0
- package/apps/jsmdcui/runtime/syntax/caddyfile.yaml +23 -0
- package/apps/jsmdcui/runtime/syntax/cake.yaml +7 -0
- package/apps/jsmdcui/runtime/syntax/clojure.yaml +38 -0
- package/apps/jsmdcui/runtime/syntax/cmake.yaml +42 -0
- package/apps/jsmdcui/runtime/syntax/coffeescript.yaml +56 -0
- package/apps/jsmdcui/runtime/syntax/colortest.yaml +19 -0
- package/apps/jsmdcui/runtime/syntax/conky.yaml +17 -0
- package/apps/jsmdcui/runtime/syntax/cpp.yaml +91 -0
- package/apps/jsmdcui/runtime/syntax/crontab.yaml +36 -0
- package/apps/jsmdcui/runtime/syntax/crystal.yaml +72 -0
- package/apps/jsmdcui/runtime/syntax/csharp.yaml +52 -0
- package/apps/jsmdcui/runtime/syntax/css.yaml +44 -0
- package/apps/jsmdcui/runtime/syntax/csx.yaml +8 -0
- package/apps/jsmdcui/runtime/syntax/cuda.yaml +68 -0
- package/apps/jsmdcui/runtime/syntax/cython.yaml +52 -0
- package/apps/jsmdcui/runtime/syntax/d.yaml +121 -0
- package/apps/jsmdcui/runtime/syntax/dart.yaml +46 -0
- package/apps/jsmdcui/runtime/syntax/default.yaml +10 -0
- package/apps/jsmdcui/runtime/syntax/dockerfile.yaml +36 -0
- package/apps/jsmdcui/runtime/syntax/dot.yaml +29 -0
- package/apps/jsmdcui/runtime/syntax/elixir.yaml +30 -0
- package/apps/jsmdcui/runtime/syntax/elm.yaml +38 -0
- package/apps/jsmdcui/runtime/syntax/erb.yaml +42 -0
- package/apps/jsmdcui/runtime/syntax/erlang.yaml +45 -0
- package/apps/jsmdcui/runtime/syntax/fish.yaml +48 -0
- package/apps/jsmdcui/runtime/syntax/forth.yaml +34 -0
- package/apps/jsmdcui/runtime/syntax/fortran.yaml +64 -0
- package/apps/jsmdcui/runtime/syntax/freebsd-kernel.yaml +14 -0
- package/apps/jsmdcui/runtime/syntax/fsharp.yaml +48 -0
- package/apps/jsmdcui/runtime/syntax/gdscript.yaml +61 -0
- package/apps/jsmdcui/runtime/syntax/gemini.yaml +19 -0
- package/apps/jsmdcui/runtime/syntax/gentoo-ebuild.yaml +48 -0
- package/apps/jsmdcui/runtime/syntax/gentoo-etc-portage.yaml +23 -0
- package/apps/jsmdcui/runtime/syntax/git-commit.yaml +35 -0
- package/apps/jsmdcui/runtime/syntax/git-config.yaml +14 -0
- package/apps/jsmdcui/runtime/syntax/git-rebase-todo.yaml +19 -0
- package/apps/jsmdcui/runtime/syntax/gleam.yaml +69 -0
- package/apps/jsmdcui/runtime/syntax/glsl.yaml +26 -0
- package/apps/jsmdcui/runtime/syntax/gnuplot.yaml +15 -0
- package/apps/jsmdcui/runtime/syntax/go.yaml +62 -0
- package/apps/jsmdcui/runtime/syntax/godoc.yaml +17 -0
- package/apps/jsmdcui/runtime/syntax/golo.yaml +73 -0
- package/apps/jsmdcui/runtime/syntax/gomod.yaml +31 -0
- package/apps/jsmdcui/runtime/syntax/graphql.yaml +47 -0
- package/apps/jsmdcui/runtime/syntax/groff.yaml +30 -0
- package/apps/jsmdcui/runtime/syntax/groovy.yaml +111 -0
- package/apps/jsmdcui/runtime/syntax/haml.yaml +16 -0
- package/apps/jsmdcui/runtime/syntax/hare.yaml +52 -0
- package/apps/jsmdcui/runtime/syntax/haskell.yaml +52 -0
- package/apps/jsmdcui/runtime/syntax/hc.yaml +52 -0
- package/apps/jsmdcui/runtime/syntax/html.yaml +70 -0
- package/apps/jsmdcui/runtime/syntax/html4.yaml +25 -0
- package/apps/jsmdcui/runtime/syntax/html5.yaml +25 -0
- package/apps/jsmdcui/runtime/syntax/ini.yaml +23 -0
- package/apps/jsmdcui/runtime/syntax/inputrc.yaml +14 -0
- package/apps/jsmdcui/runtime/syntax/java.yaml +37 -0
- package/apps/jsmdcui/runtime/syntax/javascript.yaml +124 -0
- package/apps/jsmdcui/runtime/syntax/jinja2.yaml +19 -0
- package/apps/jsmdcui/runtime/syntax/json.yaml +39 -0
- package/apps/jsmdcui/runtime/syntax/jsonnet.yaml +92 -0
- package/apps/jsmdcui/runtime/syntax/julia.yaml +57 -0
- package/apps/jsmdcui/runtime/syntax/justfile.yaml +40 -0
- package/apps/jsmdcui/runtime/syntax/keymap.yaml +27 -0
- package/apps/jsmdcui/runtime/syntax/kickstart.yaml +16 -0
- package/apps/jsmdcui/runtime/syntax/kotlin.yaml +66 -0
- package/apps/jsmdcui/runtime/syntax/kvlang.yaml +67 -0
- package/apps/jsmdcui/runtime/syntax/ledger.yaml +14 -0
- package/apps/jsmdcui/runtime/syntax/lfe.yaml +17 -0
- package/apps/jsmdcui/runtime/syntax/lilypond.yaml +26 -0
- package/apps/jsmdcui/runtime/syntax/lisp.yaml +17 -0
- package/apps/jsmdcui/runtime/syntax/log.yaml +92 -0
- package/apps/jsmdcui/runtime/syntax/lua.yaml +111 -0
- package/apps/jsmdcui/runtime/syntax/mail.yaml +25 -0
- package/apps/jsmdcui/runtime/syntax/makefile.yaml +38 -0
- package/apps/jsmdcui/runtime/syntax/man.yaml +12 -0
- package/apps/jsmdcui/runtime/syntax/markdown.yaml +64 -0
- package/apps/jsmdcui/runtime/syntax/mc.yaml +23 -0
- package/apps/jsmdcui/runtime/syntax/meson.yaml +51 -0
- package/apps/jsmdcui/runtime/syntax/micro.yaml +34 -0
- package/apps/jsmdcui/runtime/syntax/mpdconf.yaml +13 -0
- package/apps/jsmdcui/runtime/syntax/msbuild.yaml +6 -0
- package/apps/jsmdcui/runtime/syntax/nanorc.yaml +16 -0
- package/apps/jsmdcui/runtime/syntax/nftables.yaml +30 -0
- package/apps/jsmdcui/runtime/syntax/nginx.yaml +22 -0
- package/apps/jsmdcui/runtime/syntax/nim.yaml +27 -0
- package/apps/jsmdcui/runtime/syntax/nix.yaml +32 -0
- package/apps/jsmdcui/runtime/syntax/nu.yaml +114 -0
- package/apps/jsmdcui/runtime/syntax/objc.yaml +60 -0
- package/apps/jsmdcui/runtime/syntax/ocaml.yaml +43 -0
- package/apps/jsmdcui/runtime/syntax/octave.yaml +83 -0
- package/apps/jsmdcui/runtime/syntax/odin.yaml +64 -0
- package/apps/jsmdcui/runtime/syntax/pascal.yaml +45 -0
- package/apps/jsmdcui/runtime/syntax/patch.yaml +14 -0
- package/apps/jsmdcui/runtime/syntax/peg.yaml +16 -0
- package/apps/jsmdcui/runtime/syntax/perl.yaml +58 -0
- package/apps/jsmdcui/runtime/syntax/php.yaml +60 -0
- package/apps/jsmdcui/runtime/syntax/pkg-config.yaml +12 -0
- package/apps/jsmdcui/runtime/syntax/po.yaml +12 -0
- package/apps/jsmdcui/runtime/syntax/pony.yaml +37 -0
- package/apps/jsmdcui/runtime/syntax/pov.yaml +21 -0
- package/apps/jsmdcui/runtime/syntax/privoxy-action.yaml +14 -0
- package/apps/jsmdcui/runtime/syntax/privoxy-config.yaml +10 -0
- package/apps/jsmdcui/runtime/syntax/privoxy-filter.yaml +12 -0
- package/apps/jsmdcui/runtime/syntax/proto.yaml +40 -0
- package/apps/jsmdcui/runtime/syntax/prql.yaml +84 -0
- package/apps/jsmdcui/runtime/syntax/puppet.yaml +22 -0
- package/apps/jsmdcui/runtime/syntax/python2.yaml +60 -0
- package/apps/jsmdcui/runtime/syntax/python3.yaml +80 -0
- package/apps/jsmdcui/runtime/syntax/r.yaml +32 -0
- package/apps/jsmdcui/runtime/syntax/raku.yaml +42 -0
- package/apps/jsmdcui/runtime/syntax/reST.yaml +18 -0
- package/apps/jsmdcui/runtime/syntax/renpy.yaml +15 -0
- package/apps/jsmdcui/runtime/syntax/rpmspec.yaml +43 -0
- package/apps/jsmdcui/runtime/syntax/ruby.yaml +73 -0
- package/apps/jsmdcui/runtime/syntax/rust.yaml +78 -0
- package/apps/jsmdcui/runtime/syntax/sage.yaml +60 -0
- package/apps/jsmdcui/runtime/syntax/scad.yaml +53 -0
- package/apps/jsmdcui/runtime/syntax/scala.yaml +33 -0
- package/apps/jsmdcui/runtime/syntax/sed.yaml +13 -0
- package/apps/jsmdcui/runtime/syntax/sh.yaml +69 -0
- package/apps/jsmdcui/runtime/syntax/sls.yaml +15 -0
- package/apps/jsmdcui/runtime/syntax/smalltalk.yaml +55 -0
- package/apps/jsmdcui/runtime/syntax/solidity.yaml +41 -0
- package/apps/jsmdcui/runtime/syntax/sql.yaml +35 -0
- package/apps/jsmdcui/runtime/syntax/stata.yaml +67 -0
- package/apps/jsmdcui/runtime/syntax/svelte.yaml +27 -0
- package/apps/jsmdcui/runtime/syntax/swift.yaml +103 -0
- package/apps/jsmdcui/runtime/syntax/systemd.yaml +16 -0
- package/apps/jsmdcui/runtime/syntax/tcl.yaml +18 -0
- package/apps/jsmdcui/runtime/syntax/terraform.yaml +87 -0
- package/apps/jsmdcui/runtime/syntax/tex.yaml +32 -0
- package/apps/jsmdcui/runtime/syntax/toml.yaml +56 -0
- package/apps/jsmdcui/runtime/syntax/twig.yaml +55 -0
- package/apps/jsmdcui/runtime/syntax/typescript.yaml +49 -0
- package/apps/jsmdcui/runtime/syntax/v.yaml +80 -0
- package/apps/jsmdcui/runtime/syntax/vala.yaml +26 -0
- package/apps/jsmdcui/runtime/syntax/verilog.yaml +60 -0
- package/apps/jsmdcui/runtime/syntax/vhdl.yaml +37 -0
- package/apps/jsmdcui/runtime/syntax/vi.yaml +31 -0
- package/apps/jsmdcui/runtime/syntax/vue.yaml +64 -0
- package/apps/jsmdcui/runtime/syntax/xml.yaml +37 -0
- package/apps/jsmdcui/runtime/syntax/xresources.yaml +14 -0
- package/apps/jsmdcui/runtime/syntax/yaml.yaml +34 -0
- package/apps/jsmdcui/runtime/syntax/yum.yaml +12 -0
- package/apps/jsmdcui/runtime/syntax/zig.yaml +52 -0
- package/apps/jsmdcui/runtime/syntax/zscript.yaml +72 -0
- package/apps/jsmdcui/runtime/syntax/zsh.yaml +52 -0
- package/apps/jsmdcui/single-exe/README.md +473 -0
- package/apps/jsmdcui/single-exe/assetsHelper.js +191 -0
- package/apps/jsmdcui/single-exe/assetsLoader.mjs +85 -0
- package/apps/jsmdcui/single-exe/compiled.js +212 -0
- package/apps/jsmdcui/single-exe/entry.mjs +10 -0
- package/apps/jsmdcui/single-exe/packAssets.sh +7 -0
- package/apps/jsmdcui/src/MDCUI_DEFAULT_EDIT +0 -0
- package/apps/jsmdcui/src/buffer/backup.js +165 -0
- package/apps/jsmdcui/src/buffer/buffer.js +126 -0
- package/apps/jsmdcui/src/buffer/fixed3-codec.js +140 -0
- package/apps/jsmdcui/src/buffer/loc.js +38 -0
- package/apps/jsmdcui/src/buffer/message.js +29 -0
- package/apps/jsmdcui/src/build-args.js +40 -0
- package/apps/jsmdcui/src/config/clean.js +172 -0
- package/apps/jsmdcui/src/config/colorscheme.js +99 -0
- package/apps/jsmdcui/src/config/config.js +125 -0
- package/apps/jsmdcui/src/config/defaults.js +109 -0
- package/apps/jsmdcui/src/cui/fence-events.mjs +144 -0
- package/apps/jsmdcui/src/cui/heading-ids.mjs +1568 -0
- package/apps/jsmdcui/src/cui/id-collision.mjs +111 -0
- package/apps/jsmdcui/src/cui/identity.mjs +26 -0
- package/apps/jsmdcui/src/cui/kitty-debug.mjs +25 -0
- package/apps/jsmdcui/src/cui/kitty-images.mjs +280 -0
- package/apps/jsmdcui/src/cui/kitty-mode.mjs +6 -0
- package/apps/jsmdcui/src/cui/rerender-queue.mjs +66 -0
- package/apps/jsmdcui/src/cui/rpc.mjs +1525 -0
- package/apps/jsmdcui/src/cui/server.mjs +128 -0
- package/apps/jsmdcui/src/cui/table-render.mjs +286 -0
- package/apps/jsmdcui/src/cui/table-row-edit.mjs +226 -0
- package/apps/jsmdcui/src/cui/task-checkbox.mjs +60 -0
- package/apps/jsmdcui/src/cui/template-components.mjs +253 -0
- package/apps/jsmdcui/src/cui/text-block-resize.mjs +177 -0
- package/apps/jsmdcui/src/cui/tui-links.mjs +560 -0
- package/apps/jsmdcui/src/display/ansi-style.js +60 -0
- package/apps/jsmdcui/src/highlight/highlighter.js +243 -0
- package/apps/jsmdcui/src/highlight/parser.js +225 -0
- package/apps/jsmdcui/src/index.js +9573 -0
- package/apps/jsmdcui/src/lua/engine.js +68 -0
- package/apps/jsmdcui/src/platform/archive.js +50 -0
- package/apps/jsmdcui/src/platform/clipboard.js +278 -0
- package/apps/jsmdcui/src/platform/commands.js +221 -0
- package/apps/jsmdcui/src/platform/terminal.js +5 -0
- package/apps/jsmdcui/src/plugins/js-bridge.js +3377 -0
- package/apps/jsmdcui/src/plugins/manager.js +674 -0
- package/apps/jsmdcui/src/runtime/encodings.js +10 -0
- package/apps/jsmdcui/src/runtime/registry.js +134 -0
- package/apps/jsmdcui/src/screen/cell-buffer.js +81 -0
- package/apps/jsmdcui/src/screen/events.js +263 -0
- package/apps/jsmdcui/src/screen/screen.js +249 -0
- package/apps/jsmdcui/src/screen/vt100.js +571 -0
- package/apps/jsmdcui/src/shell/shell.js +70 -0
- package/apps/jsmdcui/testapp.md +78 -0
- package/apps/jsmdcui/tests/assets-helper.test.js +150 -0
- package/apps/jsmdcui/tests/backup.test.js +158 -0
- package/apps/jsmdcui/tests/cat-markdown.test.js +139 -0
- package/apps/jsmdcui/tests/cmphex3b64.js +95 -0
- package/apps/jsmdcui/tests/compiled-runtime.test.js +139 -0
- package/apps/jsmdcui/tests/config-settings.test.js +52 -0
- package/apps/jsmdcui/tests/demo.test.js +447 -0
- package/apps/jsmdcui/tests/docs-sync.test.js +14 -0
- package/apps/jsmdcui/tests/fence-events.test.js +1293 -0
- package/apps/jsmdcui/tests/heading-ids.test.js +559 -0
- package/apps/jsmdcui/tests/heading-list-selector.test.js +2393 -0
- package/apps/jsmdcui/tests/id-collision.test.js +514 -0
- package/apps/jsmdcui/tests/js-plugin-prompts.test.js +110 -0
- package/apps/jsmdcui/tests/key-event.md +10 -0
- package/apps/jsmdcui/tests/kitty-demo.md +184 -0
- package/apps/jsmdcui/tests/kitty-images.test.js +288 -0
- package/apps/jsmdcui/tests/kitty-mode.test.js +14 -0
- package/apps/jsmdcui/tests/platform-commands.test.js +18 -0
- package/apps/jsmdcui/tests/platform-terminal.test.js +8 -0
- package/apps/jsmdcui/tests/pty-demo.js +492 -0
- package/apps/jsmdcui/tests/rerender-queue.test.js +130 -0
- package/apps/jsmdcui/tests/table-render.test.js +150 -0
- package/apps/jsmdcui/tests/table-row-edit.test.js +138 -0
- package/apps/jsmdcui/tests/task-checkbox.test.js +33 -0
- package/apps/jsmdcui/tests/template-components.test.js +422 -0
- package/apps/jsmdcui/tests/text-block-resize.test.js +222 -0
- package/apps/jsmdcui/tests/textarea.md +8 -0
- package/apps/jsmdcui/tests/tui-links.test.js +298 -0
- package/apps/jsmdcui/tests/wui-responsive-images.test.js +60 -0
- package/apps/jsmdcui/tests/wui.test.js +108 -0
- package/apps/jsmdcui/tests/wv-client.js +96 -0
- package/apps/jsmdcui/tui +7 -0
- package/apps/jsmdcui/wui +9 -0
- package/apps/musl-la/LICENSES/Apache-2.0_LLVM_Exceptions_license.txt +311 -0
- package/apps/musl-la/LICENSES/Apache-2.0_license.txt +177 -0
- package/apps/musl-la/LICENSES/BSD-3-Clause_license.txt +43 -0
- package/apps/musl-la/LICENSES/GPL-3.0.txt +674 -0
- package/apps/musl-la/LICENSES/LGPL-3.0.txt +165 -0
- package/apps/musl-la/LICENSES/MIT.txt +21 -0
- package/apps/musl-la/LICENSES/curl_license.txt +22 -0
- package/apps/musl-la/LICENSES/gcc_runtime_exception.txt +73 -0
- package/apps/musl-la/LICENSES/zlib_license.txt +22 -0
- package/apps/musl-la/LICENSE_musl.txt +193 -0
- package/apps/musl-la/NOTICE +56 -0
- package/apps/musl-la/ldmusl +0 -0
- package/apps/musl-la/libgcc_s.so.1 +0 -0
- package/apps/musl-la/libstdc++.so.6 +0 -0
- package/apps/musl-la/musl-la.sh +5 -0
- package/bin/bun.sh +57 -0
- package/bin/glow.sh +5 -0
- package/bin/init.js +395 -0
- package/bin/jmi.sh +5 -0
- package/bin/jsgotty.sh +5 -0
- package/bin/libsh-loader.c +135 -0
- package/bin/libsh-loader.so +0 -0
- package/bin/multicall.sh +90 -0
- package/bin/shc.js +5 -0
- package/bin/switch_to_android.sh +9 -0
- package/bin/switch_to_linux.sh +7 -0
- package/icon.png +0 -0
- package/package.json +31 -0
package/bin/init.js
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import pkg from "../package.json" with { type: "json" };
|
|
4
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
5
|
+
import { tmpdir as systemTmpDir } from "node:os";
|
|
6
|
+
import { basename, delimiter, dirname, isAbsolute, resolve } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const binDir = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const rootDir = resolve(binDir, "..");
|
|
11
|
+
const REPO_ROOT = rootDir;
|
|
12
|
+
|
|
13
|
+
function fail(message) {
|
|
14
|
+
console.error(`${pkg.name}: ${message}`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function usage() {
|
|
19
|
+
return `${pkg.name} - ${pkg.description}
|
|
20
|
+
|
|
21
|
+
Usage:
|
|
22
|
+
${pkg.name} [init options] [jsgotty options]
|
|
23
|
+
|
|
24
|
+
Init options:
|
|
25
|
+
-h, --help Show this help and exit
|
|
26
|
+
-V, --version Show version and runtime information, then exit
|
|
27
|
+
--readme Render README.md in the terminal and exit
|
|
28
|
+
--shell <path|name> Override buninu.shell for this run
|
|
29
|
+
--command <command> Override buninu.command for this run
|
|
30
|
+
|
|
31
|
+
Package configuration:
|
|
32
|
+
package.json contains a buninu section for default and platform settings.
|
|
33
|
+
buninu.shell Select the shell to start
|
|
34
|
+
buninu.command Run a startup command before entering the shell
|
|
35
|
+
|
|
36
|
+
All other options are forwarded to jsgotty. Without buninu.command, the
|
|
37
|
+
selected shell starts directly. With a command, it runs from the package.json
|
|
38
|
+
directory and then returns to the interactive shell regardless of exit status.
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function handleInformationArguments(arguments_) {
|
|
43
|
+
if (arguments_.includes("-h") || arguments_.includes("--help")) {
|
|
44
|
+
console.log(usage());
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (arguments_.includes("-V") || arguments_.includes("--version")) {
|
|
49
|
+
console.log(`${pkg.name}: ${pkg.description}`);
|
|
50
|
+
console.log("Version:", pkg.version);
|
|
51
|
+
console.log("Runtime:", `Bun ${Bun.version}`);
|
|
52
|
+
console.log("Platform:", `${process.platform}/${process.arch}`);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (arguments_.includes("--readme")) {
|
|
57
|
+
const readmePath = resolve(REPO_ROOT, "README.md");
|
|
58
|
+
if (!await pathExists(readmePath)) fail(`README not found: ${readmePath}`);
|
|
59
|
+
const markdown = await Bun.file(readmePath).text();
|
|
60
|
+
process.stdout.write(Bun.markdown.ansi(markdown, { hyperlinks: true }));
|
|
61
|
+
if (!markdown.endsWith("\n")) process.stdout.write("\n");
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function splitCommand(command) {
|
|
69
|
+
const words = [];
|
|
70
|
+
let word = "";
|
|
71
|
+
let quote = "";
|
|
72
|
+
let escaped = false;
|
|
73
|
+
|
|
74
|
+
for (const char of command.trim()) {
|
|
75
|
+
if (escaped) {
|
|
76
|
+
word += char;
|
|
77
|
+
escaped = false;
|
|
78
|
+
} else if (char === "\\" && quote !== "'") {
|
|
79
|
+
escaped = true;
|
|
80
|
+
} else if (quote) {
|
|
81
|
+
if (char === quote) quote = "";
|
|
82
|
+
else word += char;
|
|
83
|
+
} else if (char === "'" || char === '"') {
|
|
84
|
+
quote = char;
|
|
85
|
+
} else if (/\s/.test(char)) {
|
|
86
|
+
if (word) words.push(word), word = "";
|
|
87
|
+
} else {
|
|
88
|
+
word += char;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (escaped || quote) fail("invalid quoting in package.json scripts.start");
|
|
93
|
+
if (word) words.push(word);
|
|
94
|
+
return words;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function pathExists(path) {
|
|
98
|
+
return Bun.file(path).exists();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function findCommand(command) {
|
|
102
|
+
if (!command) return null;
|
|
103
|
+
if (command.includes("/") || command.includes("\\")) {
|
|
104
|
+
const path = isAbsolute(command) ? command : resolve(rootDir, command);
|
|
105
|
+
return await pathExists(path) ? path : null;
|
|
106
|
+
}
|
|
107
|
+
return Bun.which(command);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function detectEnvironment() {
|
|
111
|
+
const windows = process.platform === "win32" || Boolean(process.env.WINDIR);
|
|
112
|
+
const android = !windows && (
|
|
113
|
+
process.platform === "android" ||
|
|
114
|
+
await pathExists("/system/bin/linker64") ||
|
|
115
|
+
Boolean(process.env.ANDROID_ROOT && process.env.ANDROID_DATA)
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
if (windows) {
|
|
119
|
+
return {
|
|
120
|
+
name: "windows",
|
|
121
|
+
shell:
|
|
122
|
+
await findCommand(process.env.COMSPEC) ||
|
|
123
|
+
Bun.which("pwsh.exe") ||
|
|
124
|
+
Bun.which("powershell.exe") ||
|
|
125
|
+
Bun.which("cmd.exe") ||
|
|
126
|
+
"cmd.exe",
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (android) {
|
|
131
|
+
return {
|
|
132
|
+
name: "android",
|
|
133
|
+
shell:
|
|
134
|
+
await findCommand(process.env.SHELL) ||
|
|
135
|
+
(await pathExists("/system/bin/sh") ? "/system/bin/sh" : null) ||
|
|
136
|
+
Bun.which("sh") ||
|
|
137
|
+
"sh",
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (process.platform === "darwin") {
|
|
142
|
+
return {
|
|
143
|
+
name: "macos",
|
|
144
|
+
shell:
|
|
145
|
+
await findCommand(process.env.SHELL) ||
|
|
146
|
+
Bun.which("zsh") ||
|
|
147
|
+
Bun.which("bash") ||
|
|
148
|
+
Bun.which("sh") ||
|
|
149
|
+
"/bin/zsh",
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (process.platform === "linux") {
|
|
154
|
+
return {
|
|
155
|
+
name: "linux",
|
|
156
|
+
shell:
|
|
157
|
+
await findCommand(process.env.SHELL) ||
|
|
158
|
+
Bun.which("bash") ||
|
|
159
|
+
Bun.which("sh") ||
|
|
160
|
+
"/bin/sh",
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
name: `unix:${process.platform}`,
|
|
166
|
+
shell:
|
|
167
|
+
await findCommand(process.env.SHELL) ||
|
|
168
|
+
Bun.which("bash") ||
|
|
169
|
+
Bun.which("sh") ||
|
|
170
|
+
"/bin/sh",
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function runPlatformSwitch(environment) {
|
|
175
|
+
const scriptName = environment.name === "android"
|
|
176
|
+
? "switch_to_android.sh"
|
|
177
|
+
: environment.name === "linux"
|
|
178
|
+
? "switch_to_linux.sh"
|
|
179
|
+
: null;
|
|
180
|
+
if (!scriptName) return;
|
|
181
|
+
|
|
182
|
+
const scriptPath = resolve(binDir, scriptName);
|
|
183
|
+
if (!await pathExists(scriptPath)) {
|
|
184
|
+
fail(`platform switch script does not exist: ${scriptPath}`);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const shell = environment.name === "android" && await pathExists("/system/bin/sh")
|
|
188
|
+
? "/system/bin/sh"
|
|
189
|
+
: Bun.which("sh") || "/bin/sh";
|
|
190
|
+
const result = Bun.spawn([shell, scriptPath], {
|
|
191
|
+
cwd: rootDir,
|
|
192
|
+
env: { ...process.env },
|
|
193
|
+
stdin: "inherit",
|
|
194
|
+
stdout: "inherit",
|
|
195
|
+
stderr: "inherit",
|
|
196
|
+
});
|
|
197
|
+
const status = await result.exited;
|
|
198
|
+
if (status !== 0) {
|
|
199
|
+
fail(`${scriptName} failed with exit ${status}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function getFreePort() {
|
|
204
|
+
const listener = Bun.listen({
|
|
205
|
+
hostname: "127.0.0.1",
|
|
206
|
+
port: 0,
|
|
207
|
+
socket: {
|
|
208
|
+
data() {},
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
const port = listener.port;
|
|
212
|
+
listener.stop(true);
|
|
213
|
+
return port;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async function createChildEnvironment(environment) {
|
|
217
|
+
const packageDir = dirname(rootDir);
|
|
218
|
+
const androidCacheDir = resolve(packageDir, "cache");
|
|
219
|
+
const tmpDir = process.env.TMPDIR || (
|
|
220
|
+
environment.name === "android"
|
|
221
|
+
? existsSync(androidCacheDir)
|
|
222
|
+
? androidCacheDir
|
|
223
|
+
: resolve(rootDir, "tmp")
|
|
224
|
+
: systemTmpDir()
|
|
225
|
+
);
|
|
226
|
+
const homeDir = process.env.HOME || rootDir;
|
|
227
|
+
const envFile = await pathExists(resolve(rootDir, ".bashrc"))
|
|
228
|
+
? resolve(rootDir, ".bashrc")
|
|
229
|
+
: await pathExists(resolve(homeDir, ".bashrc"))
|
|
230
|
+
? resolve(homeDir, ".bashrc")
|
|
231
|
+
: null;
|
|
232
|
+
|
|
233
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
234
|
+
|
|
235
|
+
const inheritedPath = process.env.PATH || "";
|
|
236
|
+
const hasTermuxExecPreload =
|
|
237
|
+
environment.name === "android" &&
|
|
238
|
+
String(process.env.LD_PRELOAD || "").includes("libtermux-exec.so");
|
|
239
|
+
const pathEntries = [
|
|
240
|
+
...(hasTermuxExecPreload ? ["/system/bin"] : []),
|
|
241
|
+
inheritedPath,
|
|
242
|
+
binDir,
|
|
243
|
+
].filter(Boolean);
|
|
244
|
+
|
|
245
|
+
return {
|
|
246
|
+
...process.env,
|
|
247
|
+
PATH: pathEntries.join(delimiter),
|
|
248
|
+
HOME: homeDir,
|
|
249
|
+
TMPDIR: tmpDir,
|
|
250
|
+
SHELL: process.env.SHELL || environment.shell,
|
|
251
|
+
BUNINU_HOME: rootDir,
|
|
252
|
+
...(envFile ? { ENV: envFile } : {}),
|
|
253
|
+
TERM: process.env.TERM || "xterm-256color",
|
|
254
|
+
COLORTERM: process.env.COLORTERM || "truecolor",
|
|
255
|
+
DISPLAY: process.env.DISPLAY || "127.0.0.1:0",
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function readInitArguments(arguments_) {
|
|
260
|
+
const forwarded = [];
|
|
261
|
+
let shell = null;
|
|
262
|
+
let command = null;
|
|
263
|
+
|
|
264
|
+
for (let index = 0; index < arguments_.length; index += 1) {
|
|
265
|
+
const argument = arguments_[index];
|
|
266
|
+
if (argument === "--shell" || argument === "--terminal") {
|
|
267
|
+
shell = arguments_[index + 1];
|
|
268
|
+
if (!shell) fail(`${argument} requires a command or executable path`);
|
|
269
|
+
index += 1;
|
|
270
|
+
} else if (argument.startsWith("--shell=") || argument.startsWith("--terminal=")) {
|
|
271
|
+
shell = argument.slice(argument.indexOf("=") + 1);
|
|
272
|
+
if (!shell) fail(`${argument.split("=")[0]} requires a command or executable path`);
|
|
273
|
+
} else if (argument === "--command") {
|
|
274
|
+
command = arguments_[index + 1];
|
|
275
|
+
if (!command) fail("--command requires a shell command string");
|
|
276
|
+
index += 1;
|
|
277
|
+
} else if (argument.startsWith("--command=")) {
|
|
278
|
+
command = argument.slice("--command=".length);
|
|
279
|
+
if (!command) fail("--command requires a shell command string");
|
|
280
|
+
} else {
|
|
281
|
+
forwarded.push(argument);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return { shell, command, forwarded };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function shellCommandArguments(shell, command) {
|
|
289
|
+
if (!command) return [shell];
|
|
290
|
+
|
|
291
|
+
const shellName = basename(shell).toLowerCase();
|
|
292
|
+
if (shellName === "cmd" || shellName === "cmd.exe") {
|
|
293
|
+
const quotedShell = `"${shell.replaceAll('"', '""')}"`;
|
|
294
|
+
return [shell, "/d", "/s", "/c", `${command} & ${quotedShell}`];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (["powershell", "powershell.exe", "pwsh", "pwsh.exe"].includes(shellName)) {
|
|
298
|
+
const escapedShell = shell.replaceAll("'", "''");
|
|
299
|
+
return [
|
|
300
|
+
shell,
|
|
301
|
+
"-NoLogo",
|
|
302
|
+
"-Command",
|
|
303
|
+
`& { ${command}; if (-not $?) { Write-Error 'Startup command failed' }; & '${escapedShell}' -NoExit }`,
|
|
304
|
+
];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const wrapped =
|
|
308
|
+
`(\n${command}\n)\n` +
|
|
309
|
+
`status=$?\n` +
|
|
310
|
+
`if [ "$status" -ne 0 ]; then\n` +
|
|
311
|
+
` echo "buninu: startup command failed with exit $status" >&2\n` +
|
|
312
|
+
`fi\n` +
|
|
313
|
+
`exec "$0"`;
|
|
314
|
+
// The argument after the command string becomes $0. Passing the shell path
|
|
315
|
+
// as argv avoids interpolating or quoting an executable path inside the
|
|
316
|
+
// user's shell command.
|
|
317
|
+
return [shell, "-c", wrapped, shell];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const startScript = pkg.scripts?.start;
|
|
321
|
+
if (typeof startScript !== "string" || !startScript.trim()) {
|
|
322
|
+
fail("package.json does not define scripts.start");
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (await handleInformationArguments(process.argv.slice(2))) process.exit(0);
|
|
326
|
+
|
|
327
|
+
const command = splitCommand(startScript);
|
|
328
|
+
if (!command.length) fail("package.json scripts.start is empty");
|
|
329
|
+
|
|
330
|
+
// Use the Bun currently running init.js instead of relying on a second PATH lookup.
|
|
331
|
+
if (command[0] === "bun") command[0] = process.execPath;
|
|
332
|
+
|
|
333
|
+
const environment = await detectEnvironment();
|
|
334
|
+
await runPlatformSwitch(environment);
|
|
335
|
+
const initArguments = readInitArguments(process.argv.slice(2));
|
|
336
|
+
const configuredShell =
|
|
337
|
+
pkg.buninu?.shell?.[environment.name] ??
|
|
338
|
+
pkg.buninu?.shell?.default ??
|
|
339
|
+
null;
|
|
340
|
+
const requestedShell =
|
|
341
|
+
initArguments.shell ||
|
|
342
|
+
configuredShell;
|
|
343
|
+
|
|
344
|
+
if (requestedShell) {
|
|
345
|
+
const resolvedShell = await findCommand(requestedShell);
|
|
346
|
+
if (!resolvedShell) {
|
|
347
|
+
fail(`configured shell does not exist: ${requestedShell}`);
|
|
348
|
+
}
|
|
349
|
+
environment.shell = resolvedShell;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
const commandConfiguration = pkg.buninu?.command;
|
|
353
|
+
const configuredCommand =
|
|
354
|
+
typeof commandConfiguration === "string"
|
|
355
|
+
? commandConfiguration
|
|
356
|
+
: commandConfiguration?.[environment.name] ??
|
|
357
|
+
commandConfiguration?.default ??
|
|
358
|
+
null;
|
|
359
|
+
const startupCommand = initArguments.command ?? configuredCommand;
|
|
360
|
+
|
|
361
|
+
const forwardedArguments = initArguments.forwarded;
|
|
362
|
+
const hasExplicitPort = forwardedArguments.some((argument) =>
|
|
363
|
+
argument === "-p" ||
|
|
364
|
+
argument === "--port" ||
|
|
365
|
+
argument.startsWith("--port=")
|
|
366
|
+
);
|
|
367
|
+
const portArguments = hasExplicitPort ? [] : ["-p", String(getFreePort())];
|
|
368
|
+
const childEnvironment = await createChildEnvironment(environment);
|
|
369
|
+
|
|
370
|
+
console.error(
|
|
371
|
+
`${pkg.name}@${pkg.version}: ${environment.name}/${process.arch}, ` +
|
|
372
|
+
`port=${portArguments[1] || "user-defined"}, shell=${environment.shell}`,
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
const child = Bun.spawn(
|
|
376
|
+
[
|
|
377
|
+
...command,
|
|
378
|
+
...portArguments,
|
|
379
|
+
...forwardedArguments,
|
|
380
|
+
...shellCommandArguments(environment.shell, startupCommand),
|
|
381
|
+
],
|
|
382
|
+
{
|
|
383
|
+
cwd: rootDir,
|
|
384
|
+
env: childEnvironment,
|
|
385
|
+
stdin: "inherit",
|
|
386
|
+
stdout: "inherit",
|
|
387
|
+
stderr: "inherit",
|
|
388
|
+
},
|
|
389
|
+
);
|
|
390
|
+
|
|
391
|
+
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
392
|
+
process.on(signal, () => child.kill(signal));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
process.exit(await child.exited);
|
package/bin/jmi.sh
ADDED
package/bin/jsgotty.sh
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#include <stdio.h>
|
|
2
|
+
#include <stdlib.h>
|
|
3
|
+
#include <string.h>
|
|
4
|
+
#include <unistd.h>
|
|
5
|
+
|
|
6
|
+
static char *append_script_suffix(const char *path) {
|
|
7
|
+
size_t path_len = strlen(path);
|
|
8
|
+
char *script_path = malloc(path_len + sizeof(".sh"));
|
|
9
|
+
|
|
10
|
+
if (!script_path) {
|
|
11
|
+
return NULL;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
memcpy(script_path, path, path_len);
|
|
15
|
+
memcpy(script_path + path_len, ".sh", sizeof(".sh"));
|
|
16
|
+
return script_path;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static char *multicall_path_for(const char *script_path) {
|
|
20
|
+
const char *slash = strrchr(script_path, '/');
|
|
21
|
+
size_t directory_len = slash ? (size_t)(slash - script_path + 1) : 0;
|
|
22
|
+
char *multicall_path = malloc(directory_len + sizeof("multicall.sh"));
|
|
23
|
+
|
|
24
|
+
if (!multicall_path) {
|
|
25
|
+
return NULL;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
memcpy(multicall_path, script_path, directory_len);
|
|
29
|
+
memcpy(multicall_path + directory_len,
|
|
30
|
+
"multicall.sh", sizeof("multicall.sh"));
|
|
31
|
+
return multicall_path;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static char *find_script_path(const char *invoked_as) {
|
|
35
|
+
if (!invoked_as || !*invoked_as) {
|
|
36
|
+
return NULL;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Relative and absolute paths are used exactly as supplied. */
|
|
40
|
+
if (strchr(invoked_as, '/')) {
|
|
41
|
+
return append_script_suffix(invoked_as);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const char *path = getenv("PATH");
|
|
45
|
+
if (!path) {
|
|
46
|
+
return NULL;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
size_t name_len = strlen(invoked_as);
|
|
50
|
+
const char *entry = path;
|
|
51
|
+
|
|
52
|
+
for (;;) {
|
|
53
|
+
const char *separator = strchr(entry, ':');
|
|
54
|
+
size_t entry_len = separator ? (size_t)(separator - entry) : strlen(entry);
|
|
55
|
+
const char *directory = entry_len ? entry : ".";
|
|
56
|
+
size_t directory_len = entry_len ? entry_len : 1;
|
|
57
|
+
int needs_slash = directory[directory_len - 1] != '/';
|
|
58
|
+
size_t executable_len = directory_len + needs_slash + name_len;
|
|
59
|
+
char *executable_path = malloc(executable_len + 1);
|
|
60
|
+
|
|
61
|
+
if (!executable_path) {
|
|
62
|
+
return NULL;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
memcpy(executable_path, directory, directory_len);
|
|
66
|
+
if (needs_slash) {
|
|
67
|
+
executable_path[directory_len] = '/';
|
|
68
|
+
}
|
|
69
|
+
memcpy(executable_path + directory_len + needs_slash,
|
|
70
|
+
invoked_as, name_len + 1);
|
|
71
|
+
|
|
72
|
+
if (access(executable_path, X_OK) == 0) {
|
|
73
|
+
char *script_path = append_script_suffix(executable_path);
|
|
74
|
+
free(executable_path);
|
|
75
|
+
return script_path;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
free(executable_path);
|
|
79
|
+
if (!separator) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
entry = separator + 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return NULL;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
int main(int argc, char *argv[]) {
|
|
89
|
+
char *path = find_script_path(argv[0]);
|
|
90
|
+
if (!path) {
|
|
91
|
+
fprintf(stderr, "Cannot locate loader in PATH: %s\n",
|
|
92
|
+
argv[0] ? argv[0] : "(null)");
|
|
93
|
+
return 127;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (access(path, F_OK) != 0) {
|
|
97
|
+
char *companion_path = path;
|
|
98
|
+
path = multicall_path_for(companion_path);
|
|
99
|
+
|
|
100
|
+
if (!path || access(path, F_OK) != 0) {
|
|
101
|
+
fprintf(stderr,
|
|
102
|
+
"Companion scripts not found: %s or %s\n",
|
|
103
|
+
companion_path,
|
|
104
|
+
path ? path : "multicall.sh");
|
|
105
|
+
free(path);
|
|
106
|
+
free(companion_path);
|
|
107
|
+
return 127;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
free(companion_path);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// new argv: ["sh", script, argv[1], ..., NULL]
|
|
114
|
+
char **new_argv = malloc(sizeof(char *) * (argc + 2));
|
|
115
|
+
if (!new_argv) {
|
|
116
|
+
free(path);
|
|
117
|
+
return 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
new_argv[0] = argv[0];
|
|
121
|
+
new_argv[1] = path;
|
|
122
|
+
|
|
123
|
+
for (int i = 1; i < argc; i++) {
|
|
124
|
+
new_argv[i + 1] = argv[i];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
new_argv[argc + 1] = NULL;
|
|
128
|
+
|
|
129
|
+
execv("/system/bin/sh", new_argv);
|
|
130
|
+
|
|
131
|
+
perror("/system/bin/sh");
|
|
132
|
+
free(new_argv);
|
|
133
|
+
free(path);
|
|
134
|
+
return 127;
|
|
135
|
+
}
|
|
Binary file
|
package/bin/multicall.sh
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
args=$(tr '\0' '\n' < /proc/$$/cmdline)
|
|
4
|
+
|
|
5
|
+
caller=$(echo "$args" | head -n 1)
|
|
6
|
+
|
|
7
|
+
callerb=$(basename "$caller")
|
|
8
|
+
|
|
9
|
+
if [ "$callerb" = sh ] ; then
|
|
10
|
+
callerb=$(basename "$0")
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
sd=$(dirname "$(realpath "$0")")
|
|
14
|
+
|
|
15
|
+
prog_base=$sd/../apps/$callerb/$callerb
|
|
16
|
+
|
|
17
|
+
# echo $prog_base
|
|
18
|
+
|
|
19
|
+
if [ -f "$sd/$callerb.sh" ] ; then
|
|
20
|
+
exec /bin/sh "$sd/$callerb.sh" "$@"
|
|
21
|
+
elif [ -f "$prog_base".sh ] ; then
|
|
22
|
+
exec /bin/sh "$prog_base".sh "$@"
|
|
23
|
+
elif [ -f "$prog_base".js ] ; then
|
|
24
|
+
exec bun "$prog_base".js "$@"
|
|
25
|
+
elif [ -f "$prog_base".mjs ] ; then
|
|
26
|
+
exec bun "$prog_base".mjs "$@"
|
|
27
|
+
elif [ -f "$prog_base".ts ] ; then
|
|
28
|
+
exec bun "$prog_base".ts "$@"
|
|
29
|
+
elif [ -f "$prog_base".mts ] ; then
|
|
30
|
+
exec bun "$prog_base".mts "$@"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
exit 127
|
|
34
|
+
|
|
35
|
+
realscript="$PKG_RDIR"/bin/"$callerb.sh"
|
|
36
|
+
realjs="$PKG_RDIR"/bin/"$callerb.js"
|
|
37
|
+
realmjs="$PKG_RDIR"/bin/"$callerb.mjs"
|
|
38
|
+
realtool="$PKG_RDIR/$callerb"
|
|
39
|
+
|
|
40
|
+
jtool_list="
|
|
41
|
+
javac
|
|
42
|
+
javap
|
|
43
|
+
javadoc
|
|
44
|
+
jcmd
|
|
45
|
+
jar
|
|
46
|
+
jarsigner
|
|
47
|
+
jconsole
|
|
48
|
+
jdb
|
|
49
|
+
jdeprscan
|
|
50
|
+
jdeps
|
|
51
|
+
jhsdb
|
|
52
|
+
jimage
|
|
53
|
+
jinfo
|
|
54
|
+
jlink
|
|
55
|
+
jmap
|
|
56
|
+
jmod
|
|
57
|
+
jpackage
|
|
58
|
+
jps
|
|
59
|
+
jshell
|
|
60
|
+
jstack
|
|
61
|
+
jstat
|
|
62
|
+
jstatd
|
|
63
|
+
serialver
|
|
64
|
+
jfr
|
|
65
|
+
jrunscript
|
|
66
|
+
keytool
|
|
67
|
+
rmiregistry
|
|
68
|
+
"
|
|
69
|
+
|
|
70
|
+
if [ -f "$realscript" ] ; then
|
|
71
|
+
exec sh "$realscript" "$@"
|
|
72
|
+
elif [ -f "$realjs" ] ; then
|
|
73
|
+
exec sh "$shr" node "$realjs" "$@"
|
|
74
|
+
elif [ -f "$realmjs" ] ; then
|
|
75
|
+
exec sh "$shr" node "$realmjs" "$@"
|
|
76
|
+
elif [ "$callerb" = "run" ] ; then
|
|
77
|
+
exec sh "$shr" "$@"
|
|
78
|
+
elif [ -d "$realtool" ] ; then
|
|
79
|
+
exec sh "$shr" "$callerb" "$@"
|
|
80
|
+
elif [ -f "$PKG_RDIR"/bin/java.sh ] &&
|
|
81
|
+
echo "$jtool_list" | grep -q "^$callerb$" ; then
|
|
82
|
+
exec sh "$PKG_RDIR"/bin/java.sh --tool-name "$callerb" "$@"
|
|
83
|
+
else
|
|
84
|
+
exec sh "$shr" pkg run "$callerb" "$@"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export ANCI_SCRIPT_LOADER_PATH=""
|
|
89
|
+
|
|
90
|
+
exec "$PKG_RDIR"/bin/shloader
|
package/bin/shc.js
ADDED
package/icon.png
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "buninu",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Buninu is a portable, self-bootstrapping Unix-like userspace built on Bun that runs across operating systems",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./bin/init.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"buninu": "bin/init.js"
|
|
10
|
+
},
|
|
11
|
+
"buninu": {
|
|
12
|
+
"shell": {
|
|
13
|
+
"default": null,
|
|
14
|
+
"android": null,
|
|
15
|
+
"linux": null,
|
|
16
|
+
"macos": null,
|
|
17
|
+
"windows": null
|
|
18
|
+
},
|
|
19
|
+
"command": {
|
|
20
|
+
"default": null,
|
|
21
|
+
"android": "echo Welcome to Buninu Android",
|
|
22
|
+
"linux": null,
|
|
23
|
+
"macos": null,
|
|
24
|
+
"windows": null
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"start": "bun ./apps/jsgotty/gotty.js --reconnect -r -w --webgl",
|
|
29
|
+
"check": "node --check ./bin/init.js"
|
|
30
|
+
}
|
|
31
|
+
}
|