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
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// No imports needed: `micro` is available as a global.
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
|
|
5
|
+
# JS Plugin Documentation
|
|
6
|
+
|
|
7
|
+
Available hooks (register with micro.on(hookName, fn)):
|
|
8
|
+
|
|
9
|
+
Lifecycle (no args):
|
|
10
|
+
"preinit" — before plugins load
|
|
11
|
+
"init" — main plugin setup, register commands/actions here
|
|
12
|
+
"postinit" — after all plugins loaded
|
|
13
|
+
|
|
14
|
+
Buffer events:
|
|
15
|
+
"onBufferOpen" (buffer) — buffer opened (raw BufferModel, not pane adapter)
|
|
16
|
+
"onBufferClose" (buffer) — buffer closed (raw BufferModel)
|
|
17
|
+
"onSetActive" (bp) — pane became active (tab switch, close, etc.)
|
|
18
|
+
"onSave" (bp) — buffer saved
|
|
19
|
+
|
|
20
|
+
Input events:
|
|
21
|
+
"onRune" (bp, ch) — printable character inserted (ch is the string)
|
|
22
|
+
|
|
23
|
+
Cancellable hooks (return false to cancel the action):
|
|
24
|
+
"preBackspace" (bp) — before backspace; return false to block
|
|
25
|
+
"preInsertNewline" (bp) — before Enter/newline; return false to block
|
|
26
|
+
|
|
27
|
+
bp is a pane adapter with:
|
|
28
|
+
bp.Buf.Line(n) bp.Buf.LinesNum() bp.Buf.FileType()
|
|
29
|
+
bp.Buf.Insert(loc, text) bp.Buf.Replace(s, e, text)
|
|
30
|
+
bp.Cursor.X bp.Cursor.Y bp.Cursor.Loc bp.Cursor.HasSelection()
|
|
31
|
+
bp.Save() bp.Backspace() bp.CursorLeft/Right() bp.InsertNewline()
|
|
32
|
+
|
|
33
|
+
Flat buffer helpers (all 1-based line numbers, omit → cursor line):
|
|
34
|
+
micro.getLine(n?) micro.putLine(text, n?) micro.delLine(n?)
|
|
35
|
+
micro.getLines(from?, to?) micro.getLinesCount()
|
|
36
|
+
micro.getAllText() — entire buffer as one string (lines joined by "\n")
|
|
37
|
+
micro.getAllAnsiText() — rendered ANSI document, or plain text when unavailable
|
|
38
|
+
micro.clickBufferCell(x, y) — activate a 1-based MDCUI cell, or goto in other buffers
|
|
39
|
+
micro.putAllText(text) — replace entire buffer content; pushes undo
|
|
40
|
+
micro.getSelection() micro.putSelection(text)
|
|
41
|
+
|
|
42
|
+
Other micro APIs:
|
|
43
|
+
micro.CurPane() — returns pane adapter for active pane
|
|
44
|
+
micro.MakeCommand(name, fn) — register Ctrl+E command; fn(bp, args[])
|
|
45
|
+
args.raw = full original input string (bypass shellSplit)
|
|
46
|
+
e.g. for command "js 1+1": args.raw = "js 1+1", args.raw.slice(3) = "1+1"
|
|
47
|
+
micro.RegisterAction(name, fn) — register bindable action
|
|
48
|
+
micro.TermMessage(msg) — show msg in editor status row
|
|
49
|
+
micro.alert(msg) — synchronous; suspend editor, print msg, wait for Enter
|
|
50
|
+
e.g. micro.alert("Done") (do not await)
|
|
51
|
+
micro.confirm(msg) — synchronous boolean result
|
|
52
|
+
micro.prompt(msg, default?) — synchronous string or null result
|
|
53
|
+
micro.Log(...args) — console.log passthrough
|
|
54
|
+
micro.GetOption(name) micro.SetOption(name, value)
|
|
55
|
+
micro.cmd.save() — call any editor command via proxy
|
|
56
|
+
micro.action.CursorUp() — run any registered action via proxy
|
|
57
|
+
micro.shell.CMD(...args) — run CMD interactively (same as Ctrl-B); async
|
|
58
|
+
e.g. await micro.shell.ls('-l')
|
|
59
|
+
await micro.shell.git('diff', '--stat')
|
|
60
|
+
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
micro.on("init", () => {
|
|
64
|
+
// Register a custom Ctrl+E command
|
|
65
|
+
micro.MakeCommand("cdp", async (bp, args) =>
|
|
66
|
+
{
|
|
67
|
+
const addrFlag = args.find(a => a.startsWith("--address="))?.slice("--address=".length);
|
|
68
|
+
const isPublic = args.includes("--public");
|
|
69
|
+
const port = parseInt(args.find(a => /^\d+$/.test(a))) || parseInt(Bun.env.CDP_PORT) || 9222;
|
|
70
|
+
const hostname = addrFlag ?? (isPublic ? "0.0.0.0" : "127.0.0.1");
|
|
71
|
+
const path = bp?.Buf?.Path || "(no path)";
|
|
72
|
+
|
|
73
|
+
if(!micro.cdpContext)
|
|
74
|
+
{
|
|
75
|
+
micro.cdpContext={
|
|
76
|
+
title(){
|
|
77
|
+
return path;
|
|
78
|
+
},
|
|
79
|
+
async evaluate(txt){
|
|
80
|
+
return await eval(txt);
|
|
81
|
+
},
|
|
82
|
+
async navigate(url){
|
|
83
|
+
await micro.cmd.open('-f', url);
|
|
84
|
+
},
|
|
85
|
+
async click(x,y,opt){
|
|
86
|
+
x=x||1 ; y=y||1 ;
|
|
87
|
+
await micro.clickBufferCell(x, y);
|
|
88
|
+
},
|
|
89
|
+
async scroll(dx,dy){
|
|
90
|
+
const pane = micro.CurPane();
|
|
91
|
+
if (!pane) return;
|
|
92
|
+
|
|
93
|
+
dx = toInteger(dx);
|
|
94
|
+
dy = toInteger(dy);
|
|
95
|
+
|
|
96
|
+
const line = Math.max(1, pane.Cursor.Y + dy + 1);
|
|
97
|
+
const column = Math.max(1, pane.Cursor.X + dx + 1);
|
|
98
|
+
await micro.cmd.goto(`${line}:${column}`);
|
|
99
|
+
},
|
|
100
|
+
async scrollTo(selector){
|
|
101
|
+
const pattern = selectorToSearchPattern(selector);
|
|
102
|
+
await micro.cmd.find(pattern);
|
|
103
|
+
},
|
|
104
|
+
goBack(){
|
|
105
|
+
micro.action.PrevTab();
|
|
106
|
+
},
|
|
107
|
+
goForward(){
|
|
108
|
+
micro.action.NextTab();
|
|
109
|
+
},
|
|
110
|
+
async type(text){
|
|
111
|
+
const bp = micro.CurPane();
|
|
112
|
+
if (!bp) return;
|
|
113
|
+
bp.Insert(text);
|
|
114
|
+
},
|
|
115
|
+
async press(key, options){
|
|
116
|
+
const raw = cdpKeyToTerminalInput(key, options);
|
|
117
|
+
if (raw) await micro._dispatchRawInput(raw);
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let {CdpServer}=await import('./cdp-server.js');
|
|
122
|
+
|
|
123
|
+
micro.cdpPort = port;
|
|
124
|
+
CdpServer
|
|
125
|
+
.create(micro.cdpContext)
|
|
126
|
+
.listen(port, hostname);
|
|
127
|
+
|
|
128
|
+
const addr = isPublic ? `0.0.0.0:${port}` : `127.0.0.1:${port}`;
|
|
129
|
+
micro.TermMessage(`CDP@${addr} server running 伺服器啟動了`)
|
|
130
|
+
|
|
131
|
+
//micro.alert(CdpServer)
|
|
132
|
+
} // server not running
|
|
133
|
+
else
|
|
134
|
+
{
|
|
135
|
+
micro.TermMessage(`CDP@${micro.cdpPort} already running a server 已有伺服器啟動`)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
function selectorToSearchPattern(selector) {
|
|
144
|
+
const value = String(selector ?? "");
|
|
145
|
+
return value.startsWith("#") ? value.slice(1) : value;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function toInteger(value) {
|
|
149
|
+
const number = Number(value);
|
|
150
|
+
return Number.isFinite(number) ? Math.trunc(number) : 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function cdpKeyToTerminalInput(key, options = {}) {
|
|
154
|
+
const modifiers = Number(options.modifiers) || 0;
|
|
155
|
+
const alt = !!(modifiers & 1);
|
|
156
|
+
const ctrl = !!(modifiers & 2);
|
|
157
|
+
const meta = !!(modifiers & 4);
|
|
158
|
+
const shift = !!(modifiers & 8);
|
|
159
|
+
const modifierCode = 1 + (shift ? 1 : 0) + (alt || meta ? 2 : 0) + (ctrl ? 4 : 0);
|
|
160
|
+
const value = String(key ?? options.text ?? "");
|
|
161
|
+
|
|
162
|
+
const cursorFinal = {
|
|
163
|
+
ArrowUp: "A",
|
|
164
|
+
ArrowDown: "B",
|
|
165
|
+
ArrowRight: "C",
|
|
166
|
+
ArrowLeft: "D",
|
|
167
|
+
Home: "H",
|
|
168
|
+
End: "F",
|
|
169
|
+
}[value];
|
|
170
|
+
if (cursorFinal) {
|
|
171
|
+
return modifierCode === 1
|
|
172
|
+
? `\x1b[${cursorFinal}`
|
|
173
|
+
: `\x1b[1;${modifierCode}${cursorFinal}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (value === "PageUp" || value === "PageDown" || value === "Delete") {
|
|
177
|
+
const number = value === "PageUp" ? 5 : value === "PageDown" ? 6 : 3;
|
|
178
|
+
return modifierCode === 1
|
|
179
|
+
? `\x1b[${number}~`
|
|
180
|
+
: `\x1b[${number};${modifierCode}~`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (value === "Tab") return shift ? "\x1b[Z" : "\t";
|
|
184
|
+
if (value === "Enter") return alt || meta ? "\x1b\r" : "\r";
|
|
185
|
+
if (value === "Backspace") return "\x7f";
|
|
186
|
+
if (value === "Escape") return "\x1b";
|
|
187
|
+
|
|
188
|
+
let text = typeof options.text === "string" && options.text
|
|
189
|
+
? options.text
|
|
190
|
+
: value === "Space" ? " " : value;
|
|
191
|
+
if ([...text].length !== 1) return "";
|
|
192
|
+
|
|
193
|
+
if (ctrl) {
|
|
194
|
+
const code = text.toUpperCase().charCodeAt(0);
|
|
195
|
+
if (code >= 64 && code <= 95) text = String.fromCharCode(code & 31);
|
|
196
|
+
} else if (shift && /^[a-z]$/.test(text)) {
|
|
197
|
+
text = text.toUpperCase();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return alt || meta ? `\x1b${text}` : text;
|
|
201
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// example.js — demonstrates the micro JS plugin API
|
|
2
|
+
// No imports needed: `micro` is available as a global.
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
|
|
6
|
+
# JS Plugin Documentation
|
|
7
|
+
|
|
8
|
+
Available hooks (register with micro.on(hookName, fn)):
|
|
9
|
+
|
|
10
|
+
Lifecycle (no args):
|
|
11
|
+
"preinit" — before plugins load
|
|
12
|
+
"init" — main plugin setup, register commands/actions here
|
|
13
|
+
"postinit" — after all plugins loaded
|
|
14
|
+
|
|
15
|
+
Buffer events:
|
|
16
|
+
"onBufferOpen" (buffer) — buffer opened (raw BufferModel, not pane adapter)
|
|
17
|
+
"onBufferClose" (buffer) — buffer closed (raw BufferModel)
|
|
18
|
+
"onSetActive" (bp) — pane became active (tab switch, close, etc.)
|
|
19
|
+
"onSave" (bp) — buffer saved
|
|
20
|
+
|
|
21
|
+
Input events:
|
|
22
|
+
"onRune" (bp, ch) — printable character inserted (ch is the string)
|
|
23
|
+
|
|
24
|
+
Cancellable hooks (return false to cancel the action):
|
|
25
|
+
"preBackspace" (bp) — before backspace; return false to block
|
|
26
|
+
"preInsertNewline" (bp) — before Enter/newline; return false to block
|
|
27
|
+
|
|
28
|
+
bp is a pane adapter with:
|
|
29
|
+
bp.Buf.Line(n) bp.Buf.LinesNum() bp.Buf.FileType()
|
|
30
|
+
bp.Buf.Insert(loc, text) bp.Buf.Replace(s, e, text)
|
|
31
|
+
bp.Cursor.X bp.Cursor.Y bp.Cursor.Loc bp.Cursor.HasSelection()
|
|
32
|
+
bp.Save() bp.Backspace() bp.CursorLeft/Right() bp.InsertNewline()
|
|
33
|
+
|
|
34
|
+
Flat buffer helpers (all 1-based line numbers, omit → cursor line):
|
|
35
|
+
micro.getLine(n?) micro.putLine(text, n?) micro.delLine(n?)
|
|
36
|
+
micro.getLines(from?, to?) micro.getLinesCount()
|
|
37
|
+
micro.getAllText() — entire buffer as one string (lines joined by "\n")
|
|
38
|
+
micro.getAllAnsiText() — rendered ANSI document, or plain text when unavailable
|
|
39
|
+
micro.clickBufferCell(x, y) — activate a 1-based MDCUI cell, or goto in other buffers
|
|
40
|
+
micro.putAllText(text) — replace entire buffer content; pushes undo
|
|
41
|
+
micro.getSelection() micro.putSelection(text)
|
|
42
|
+
|
|
43
|
+
Other micro APIs:
|
|
44
|
+
micro.CurPane() — returns pane adapter for active pane
|
|
45
|
+
micro.MakeCommand(name, fn) — register Ctrl+E command; fn(bp, args[])
|
|
46
|
+
micro.RegisterAction(name, fn) — register bindable action
|
|
47
|
+
micro.TermMessage(msg) — show msg in editor status row
|
|
48
|
+
micro.alert(msg) — synchronous; suspend editor, print msg, wait for Enter
|
|
49
|
+
e.g. micro.alert("Done") (do not await)
|
|
50
|
+
micro.confirm(msg) — synchronous boolean result
|
|
51
|
+
micro.prompt(msg, default?) — synchronous string or null result
|
|
52
|
+
micro.Log(...args) — console.log passthrough
|
|
53
|
+
micro.GetOption(name) micro.SetOption(name, value)
|
|
54
|
+
micro.cmd.save() — call any editor command via proxy
|
|
55
|
+
micro.action.CursorUp() — run any registered action via proxy
|
|
56
|
+
micro.shell.CMD(...args) — run CMD interactively (same as Ctrl-B); async
|
|
57
|
+
e.g. await micro.shell.ls('-l')
|
|
58
|
+
await micro.shell.git('diff', '--stat')
|
|
59
|
+
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
micro.on("init", () => {
|
|
63
|
+
// Register a custom Ctrl+E command
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
micro.MakeCommand("nextchapter", async (bp, args) =>
|
|
67
|
+
{
|
|
68
|
+
let fp=bp?.Buf?.Path
|
|
69
|
+
let i1=fp.lastIndexOf('/')- -1
|
|
70
|
+
let i2=fp.lastIndexOf('.')
|
|
71
|
+
let nb=fp.slice(i1,i2)
|
|
72
|
+
let nfp=fp.slice(0,i1)+(nb- -1)+fp.slice(i2)
|
|
73
|
+
|
|
74
|
+
await micro.cmd.open('-f',nfp)
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
await micro.cmd.replaceall('曰','日')
|
|
78
|
+
await micro.cmd.replaceall('修土','修士')
|
|
79
|
+
await micro.cmd.replaceall('<p>','\n')
|
|
80
|
+
await micro.cmd.replaceall('</p>','\n')
|
|
81
|
+
await micro.cmd.goto(48)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
micro.cmd.tts()
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
micro.MakeCommand("prevchapter", async (bp, args) =>
|
|
90
|
+
{
|
|
91
|
+
let fp=bp?.Buf?.Path
|
|
92
|
+
let i1=fp.lastIndexOf('/')- -1
|
|
93
|
+
let i2=fp.lastIndexOf('.')
|
|
94
|
+
let nb=fp.slice(i1,i2)
|
|
95
|
+
let nfp=fp.slice(0,i1)+(nb-1)+fp.slice(i2)
|
|
96
|
+
|
|
97
|
+
await micro.cmd.open('-f',nfp)
|
|
98
|
+
|
|
99
|
+
/*
|
|
100
|
+
await micro.cmd.replaceall('曰','日')
|
|
101
|
+
await micro.cmd.replaceall('修土','修士')
|
|
102
|
+
await micro.cmd.replaceall('<p>','\n')
|
|
103
|
+
await micro.cmd.replaceall('</p>','\n')
|
|
104
|
+
await micro.cmd.goto(48)
|
|
105
|
+
|
|
106
|
+
micro.cmd.tts()
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// diff.js — JS port of the Lua diff plugin (Go parity)
|
|
2
|
+
// When diffgutter is enabled, fetches git HEAD content and sets it as the
|
|
3
|
+
// diff base so the editor can show added/modified/removed gutter markers.
|
|
4
|
+
//
|
|
5
|
+
// Go behavior (diff.lua):
|
|
6
|
+
// 1. Skip scratch buffers or buffers with no path.
|
|
7
|
+
// 2. Check the file exists on disk; skip if not.
|
|
8
|
+
// 3. Run: git -C <dir> show HEAD:./<file>
|
|
9
|
+
// 4. On git failure (not tracked / no commits): set diffBase = current file
|
|
10
|
+
// content — this produces no gutter markers (base == current).
|
|
11
|
+
// 5. On success: set diffBase = git HEAD content.
|
|
12
|
+
|
|
13
|
+
import { dirname, basename } from "node:path";
|
|
14
|
+
import { existsSync } from "node:fs";
|
|
15
|
+
|
|
16
|
+
const _hasGit = await Bun.which("git") !== null;
|
|
17
|
+
|
|
18
|
+
micro.on("onBufferOpen", async (buffer) => {
|
|
19
|
+
if (!_hasGit) return;
|
|
20
|
+
if (!buffer.Settings?.diffgutter) return;
|
|
21
|
+
if (buffer.Type?.Scratch) return;
|
|
22
|
+
const absPath = buffer.AbsPath || buffer.Path;
|
|
23
|
+
if (!absPath) return;
|
|
24
|
+
|
|
25
|
+
// Go: os.Stat check — only proceed if the file exists on disk
|
|
26
|
+
try { if (!existsSync(absPath)) return; } catch { return; }
|
|
27
|
+
|
|
28
|
+
const dir = dirname(absPath);
|
|
29
|
+
const file = basename(absPath);
|
|
30
|
+
try {
|
|
31
|
+
const proc = Bun.spawn(["git", "-C", dir, "show", `HEAD:./${file}`], {
|
|
32
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
33
|
+
});
|
|
34
|
+
const exitCode = await proc.exited;
|
|
35
|
+
if (exitCode === 0) {
|
|
36
|
+
const text = await new Response(proc.stdout).text();
|
|
37
|
+
buffer.SetDiffBase(text);
|
|
38
|
+
} else {
|
|
39
|
+
// Go: on git failure set diffBase = current content (no markers shown)
|
|
40
|
+
buffer.SetDiffBase(buffer.Bytes ? buffer.Bytes() : "");
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// Go: on error set diffBase = current content (no markers shown)
|
|
44
|
+
buffer.SetDiffBase(buffer.Bytes ? buffer.Bytes() : "");
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// example.js — demonstrates the micro JS plugin API
|
|
2
|
+
// No imports needed: `micro` is available as a global.
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
|
|
6
|
+
# JS Plugin Documentation
|
|
7
|
+
|
|
8
|
+
Available hooks (register with micro.on(hookName, fn)):
|
|
9
|
+
|
|
10
|
+
Lifecycle (no args):
|
|
11
|
+
"preinit" — before plugins load
|
|
12
|
+
"init" — main plugin setup, register commands/actions here
|
|
13
|
+
"postinit" — after all plugins loaded
|
|
14
|
+
|
|
15
|
+
Buffer events:
|
|
16
|
+
"onBufferOpen" (buffer) — buffer opened (raw BufferModel, not pane adapter)
|
|
17
|
+
"onBufferClose" (buffer) — buffer closed (raw BufferModel)
|
|
18
|
+
"onSetActive" (bp) — pane became active (tab switch, close, etc.)
|
|
19
|
+
"onSave" (bp) — buffer saved
|
|
20
|
+
|
|
21
|
+
Input events:
|
|
22
|
+
"onRune" (bp, ch) — printable character inserted (ch is the string)
|
|
23
|
+
|
|
24
|
+
Cancellable hooks (return false to cancel the action):
|
|
25
|
+
"preBackspace" (bp) — before backspace; return false to block
|
|
26
|
+
"preInsertNewline" (bp) — before Enter/newline; return false to block
|
|
27
|
+
|
|
28
|
+
bp is a pane adapter with:
|
|
29
|
+
bp.Buf.Line(n) bp.Buf.LinesNum() bp.Buf.FileType()
|
|
30
|
+
bp.Buf.Insert(loc, text) bp.Buf.Replace(s, e, text)
|
|
31
|
+
bp.Cursor.X bp.Cursor.Y bp.Cursor.Loc bp.Cursor.HasSelection()
|
|
32
|
+
bp.Save() bp.Backspace() bp.CursorLeft/Right() bp.InsertNewline()
|
|
33
|
+
|
|
34
|
+
Flat buffer helpers (all 1-based line numbers, omit → cursor line):
|
|
35
|
+
micro.getLine(n?) micro.putLine(text, n?) micro.delLine(n?)
|
|
36
|
+
micro.getLines(from?, to?) micro.getLinesCount()
|
|
37
|
+
micro.getAllText() — entire buffer as one string (lines joined by "\n")
|
|
38
|
+
micro.getAllAnsiText() — rendered ANSI document, or plain text when unavailable
|
|
39
|
+
micro.clickBufferCell(x, y) — activate a 1-based MDCUI cell, or goto in other buffers
|
|
40
|
+
micro.putAllText(text) — replace entire buffer content; pushes undo
|
|
41
|
+
micro.getSelection() micro.putSelection(text)
|
|
42
|
+
|
|
43
|
+
Other micro APIs:
|
|
44
|
+
micro.CurPane() — returns pane adapter for active pane
|
|
45
|
+
micro.MakeCommand(name, fn) — register Ctrl+E command; fn(bp, args[])
|
|
46
|
+
args.raw = full original input string (bypass shellSplit)
|
|
47
|
+
e.g. for command "js 1+1": args.raw = "js 1+1", args.raw.slice(3) = "1+1"
|
|
48
|
+
micro.RegisterAction(name, fn) — register bindable action
|
|
49
|
+
micro.TermMessage(msg) — show msg in editor status row
|
|
50
|
+
micro.alert(msg) — synchronous; suspend editor, print msg, wait for Enter
|
|
51
|
+
e.g. micro.alert("Done") (do not await)
|
|
52
|
+
micro.confirm(msg) — synchronous boolean result
|
|
53
|
+
micro.prompt(msg, default?) — synchronous string or null result
|
|
54
|
+
micro.Log(...args) — console.log passthrough
|
|
55
|
+
micro.GetOption(name) micro.SetOption(name, value)
|
|
56
|
+
micro.cmd.save() — call any editor command via proxy
|
|
57
|
+
micro.action.CursorUp() — run any registered action via proxy
|
|
58
|
+
micro.shell.CMD(...args) — run CMD interactively (same as Ctrl-B); async
|
|
59
|
+
e.g. await micro.shell.ls('-l')
|
|
60
|
+
await micro.shell.git('diff', '--stat')
|
|
61
|
+
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
micro.on("init", () => {
|
|
65
|
+
// Register a custom Ctrl+E command
|
|
66
|
+
micro.MakeCommand("showpath", (bp, args) =>
|
|
67
|
+
{
|
|
68
|
+
//micro.TermMessage("Hello from JS plugin! Args: " + args.join(", "));
|
|
69
|
+
|
|
70
|
+
//micro.alert(micro.getLine())
|
|
71
|
+
const path = bp?.Buf?.Path || "(no path)";
|
|
72
|
+
const moduleSource =
|
|
73
|
+
micro.CurPane()?.Buf?.MdcuiModuleSource || "external";
|
|
74
|
+
const loc = bp?.CursorLocation?.() || "+1.0:1";
|
|
75
|
+
micro.alert(`${path}\nMdcuiModuleSource: ${moduleSource}\n${loc}`)
|
|
76
|
+
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
micro.MakeCommand("js", async (bp, args) =>
|
|
81
|
+
{
|
|
82
|
+
// args.raw is the full original input string, e.g. "js console.log('hi')"
|
|
83
|
+
// slice(3) skips the "js " prefix (2-char name + 1 space)
|
|
84
|
+
const scriptText = args.raw?.slice(3) ?? args.join(" ");
|
|
85
|
+
micro.alert(await eval(scriptText));
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
// greet: shows a message via micro.alert (leaves editor, shows text, Enter returns)
|
|
90
|
+
micro.MakeCommand("greet", (bp, args) =>
|
|
91
|
+
{
|
|
92
|
+
const name = args.length ?
|
|
93
|
+
args.join(" ") : "world";
|
|
94
|
+
|
|
95
|
+
let s=Bun.markdown.ansi(
|
|
96
|
+
'# Hello\n- '+name
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
micro.alert(s);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Register a custom action (can be bound to a key in keybindings.json)
|
|
103
|
+
micro.RegisterAction("ExampleDuplicateAndComment", async () =>
|
|
104
|
+
{
|
|
105
|
+
await micro.action.DuplicateLine();
|
|
106
|
+
await micro.action.ToggleComment();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
micro.on("onSave", (bp) =>
|
|
111
|
+
{
|
|
112
|
+
// bp is the BufPane adapter
|
|
113
|
+
// (same as Lua's bp arg)
|
|
114
|
+
|
|
115
|
+
const path = bp?.Buf?.Path || "(no path)";
|
|
116
|
+
//micro.Log("[example] saved:", path);
|
|
117
|
+
});
|