buninu-linux 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (621) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSES/Bun-LICENSE.md +84 -0
  3. package/LICENSES/GCC-Runtime-Library-Exception-3.1.txt +73 -0
  4. package/LICENSES/GPL-2.0.txt +338 -0
  5. package/LICENSES/GPL-3.0.txt +674 -0
  6. package/LICENSES/LGPL-2.1.txt +501 -0
  7. package/LICENSES/Linux-syscall-note.txt +25 -0
  8. package/LICENSES/musl-COPYRIGHT.txt +193 -0
  9. package/NOTICE.md +184 -0
  10. package/README.md +537 -0
  11. package/build-image.sh +44 -0
  12. package/build-uki.sh +75 -0
  13. package/fetch-alpine.sh +80 -0
  14. package/fetch-bun.sh +41 -0
  15. package/fetch-plus-build.sh +11 -0
  16. package/hello/build-hello.sh +14 -0
  17. package/hello/hello.c +50 -0
  18. package/index.js +235 -0
  19. package/initramfs/bin/sh +3 -0
  20. package/initramfs/buninu/.bashrc +11 -0
  21. package/initramfs/buninu/ARCHITECTURE.md +452 -0
  22. package/initramfs/buninu/CHANGELOG.md +580 -0
  23. package/initramfs/buninu/LICENSE +21 -0
  24. package/initramfs/buninu/README.md +1161 -0
  25. package/initramfs/buninu/apps/bun/make-bunBin.sh +99 -0
  26. package/initramfs/buninu/apps/bunmsh/CHANGELOG.md +493 -0
  27. package/initramfs/buninu/apps/bunmsh/LICENSE +21 -0
  28. package/initramfs/buninu/apps/bunmsh/LICENSE-MICRO +58 -0
  29. package/initramfs/buninu/apps/bunmsh/LICENSE-MKSH +295 -0
  30. package/initramfs/buninu/apps/bunmsh/PORTING.md +192 -0
  31. package/initramfs/buninu/apps/bunmsh/README.md +1042 -0
  32. package/initramfs/buninu/apps/bunmsh/bunmsh +7 -0
  33. package/initramfs/buninu/apps/bunmsh/bunshell.md +61 -0
  34. package/initramfs/buninu/apps/bunmsh/help/README.md +2237 -0
  35. package/initramfs/buninu/apps/bunmsh/help/alias.md +22 -0
  36. package/initramfs/buninu/apps/bunmsh/help/basename.md +38 -0
  37. package/initramfs/buninu/apps/bunmsh/help/builtin.md +25 -0
  38. package/initramfs/buninu/apps/bunmsh/help/bun.md +27 -0
  39. package/initramfs/buninu/apps/bunmsh/help/bunmsh.md +47 -0
  40. package/initramfs/buninu/apps/bunmsh/help/cat.md +31 -0
  41. package/initramfs/buninu/apps/bunmsh/help/catfancy.md +35 -0
  42. package/initramfs/buninu/apps/bunmsh/help/cd.md +22 -0
  43. package/initramfs/buninu/apps/bunmsh/help/chmod.md +27 -0
  44. package/initramfs/buninu/apps/bunmsh/help/clear.md +21 -0
  45. package/initramfs/buninu/apps/bunmsh/help/colon.md +22 -0
  46. package/initramfs/buninu/apps/bunmsh/help/command.md +27 -0
  47. package/initramfs/buninu/apps/bunmsh/help/cp.md +28 -0
  48. package/initramfs/buninu/apps/bunmsh/help/curl.md +181 -0
  49. package/initramfs/buninu/apps/bunmsh/help/cut.md +25 -0
  50. package/initramfs/buninu/apps/bunmsh/help/date.md +25 -0
  51. package/initramfs/buninu/apps/bunmsh/help/dirname.md +25 -0
  52. package/initramfs/buninu/apps/bunmsh/help/echo.md +25 -0
  53. package/initramfs/buninu/apps/bunmsh/help/env.md +27 -0
  54. package/initramfs/buninu/apps/bunmsh/help/eval.md +22 -0
  55. package/initramfs/buninu/apps/bunmsh/help/exec.md +22 -0
  56. package/initramfs/buninu/apps/bunmsh/help/exit.md +21 -0
  57. package/initramfs/buninu/apps/bunmsh/help/export.md +22 -0
  58. package/initramfs/buninu/apps/bunmsh/help/false.md +22 -0
  59. package/initramfs/buninu/apps/bunmsh/help/find.md +33 -0
  60. package/initramfs/buninu/apps/bunmsh/help/getopts.md +28 -0
  61. package/initramfs/buninu/apps/bunmsh/help/grep.md +34 -0
  62. package/initramfs/buninu/apps/bunmsh/help/head.md +27 -0
  63. package/initramfs/buninu/apps/bunmsh/help/kill.md +43 -0
  64. package/initramfs/buninu/apps/bunmsh/help/ln.md +28 -0
  65. package/initramfs/buninu/apps/bunmsh/help/ls.md +37 -0
  66. package/initramfs/buninu/apps/bunmsh/help/lsbun.md +29 -0
  67. package/initramfs/buninu/apps/bunmsh/help/lsfancy.md +37 -0
  68. package/initramfs/buninu/apps/bunmsh/help/md5sum.md +21 -0
  69. package/initramfs/buninu/apps/bunmsh/help/mkdir.md +27 -0
  70. package/initramfs/buninu/apps/bunmsh/help/mktemp.md +26 -0
  71. package/initramfs/buninu/apps/bunmsh/help/mv.md +26 -0
  72. package/initramfs/buninu/apps/bunmsh/help/print.md +30 -0
  73. package/initramfs/buninu/apps/bunmsh/help/printf.md +25 -0
  74. package/initramfs/buninu/apps/bunmsh/help/pspa.md +38 -0
  75. package/initramfs/buninu/apps/bunmsh/help/pspac.md +57 -0
  76. package/initramfs/buninu/apps/bunmsh/help/pwd.md +21 -0
  77. package/initramfs/buninu/apps/bunmsh/help/read.md +27 -0
  78. package/initramfs/buninu/apps/bunmsh/help/readonly.md +27 -0
  79. package/initramfs/buninu/apps/bunmsh/help/realpath.md +21 -0
  80. package/initramfs/buninu/apps/bunmsh/help/rm.md +33 -0
  81. package/initramfs/buninu/apps/bunmsh/help/rmdir.md +27 -0
  82. package/initramfs/buninu/apps/bunmsh/help/sed.md +29 -0
  83. package/initramfs/buninu/apps/bunmsh/help/seq.md +29 -0
  84. package/initramfs/buninu/apps/bunmsh/help/serve.md +50 -0
  85. package/initramfs/buninu/apps/bunmsh/help/set.md +26 -0
  86. package/initramfs/buninu/apps/bunmsh/help/sha256sum.md +21 -0
  87. package/initramfs/buninu/apps/bunmsh/help/shift.md +23 -0
  88. package/initramfs/buninu/apps/bunmsh/help/sleep.md +25 -0
  89. package/initramfs/buninu/apps/bunmsh/help/sort.md +29 -0
  90. package/initramfs/buninu/apps/bunmsh/help/source.md +23 -0
  91. package/initramfs/buninu/apps/bunmsh/help/tab.md +30 -0
  92. package/initramfs/buninu/apps/bunmsh/help/tac.md +29 -0
  93. package/initramfs/buninu/apps/bunmsh/help/tail.md +27 -0
  94. package/initramfs/buninu/apps/bunmsh/help/tee.md +25 -0
  95. package/initramfs/buninu/apps/bunmsh/help/test.md +30 -0
  96. package/initramfs/buninu/apps/bunmsh/help/time.md +29 -0
  97. package/initramfs/buninu/apps/bunmsh/help/touch.md +26 -0
  98. package/initramfs/buninu/apps/bunmsh/help/tr.md +26 -0
  99. package/initramfs/buninu/apps/bunmsh/help/true.md +22 -0
  100. package/initramfs/buninu/apps/bunmsh/help/type.md +21 -0
  101. package/initramfs/buninu/apps/bunmsh/help/umask.md +22 -0
  102. package/initramfs/buninu/apps/bunmsh/help/unalias.md +28 -0
  103. package/initramfs/buninu/apps/bunmsh/help/uname.md +31 -0
  104. package/initramfs/buninu/apps/bunmsh/help/unset.md +28 -0
  105. package/initramfs/buninu/apps/bunmsh/help/wc.md +27 -0
  106. package/initramfs/buninu/apps/bunmsh/help/whence.md +26 -0
  107. package/initramfs/buninu/apps/bunmsh/help/which.md +41 -0
  108. package/initramfs/buninu/apps/bunmsh/help/yes.md +23 -0
  109. package/initramfs/buninu/apps/bunmsh/index.js +7 -0
  110. package/initramfs/buninu/apps/bunmsh/package.json +30 -0
  111. package/initramfs/buninu/apps/bunmsh/serve.js +468 -0
  112. package/initramfs/buninu/apps/bunmsh/single-exe/README.md +402 -0
  113. package/initramfs/buninu/apps/bunmsh/single-exe/assetsHelper.js +371 -0
  114. package/initramfs/buninu/apps/bunmsh/single-exe/assetsLoader.mjs +85 -0
  115. package/initramfs/buninu/apps/bunmsh/single-exe/assetsPacker.js +218 -0
  116. package/initramfs/buninu/apps/bunmsh/single-exe/compiled.js +527 -0
  117. package/initramfs/buninu/apps/bunmsh/single-exe/entry.mjs +17 -0
  118. package/initramfs/buninu/apps/bunmsh/src/cat-fancy.js +117 -0
  119. package/initramfs/buninu/apps/bunmsh/src/cat-operands.js +31 -0
  120. package/initramfs/buninu/apps/bunmsh/src/completion.js +363 -0
  121. package/initramfs/buninu/apps/bunmsh/src/curl.js +1191 -0
  122. package/initramfs/buninu/apps/bunmsh/src/environment.js +61 -0
  123. package/initramfs/buninu/apps/bunmsh/src/fancy-ls.js +186 -0
  124. package/initramfs/buninu/apps/bunmsh/src/find.js +119 -0
  125. package/initramfs/buninu/apps/bunmsh/src/history.js +198 -0
  126. package/initramfs/buninu/apps/bunmsh/src/main.js +850 -0
  127. package/initramfs/buninu/apps/bunmsh/src/mouse.js +103 -0
  128. package/initramfs/buninu/apps/bunmsh/src/shell.js +3932 -0
  129. package/initramfs/buninu/apps/bunmsh/test/catfancy.test.js +102 -0
  130. package/initramfs/buninu/apps/bunmsh/test/curl.test.js +335 -0
  131. package/initramfs/buninu/apps/bunmsh/test/reference-source.sh +1 -0
  132. package/initramfs/buninu/apps/bunmsh/test/reference.test.js +817 -0
  133. package/initramfs/buninu/apps/bunmsh/test/serve/README.md +3 -0
  134. package/initramfs/buninu/apps/bunmsh/test/serve/bad.json +1 -0
  135. package/initramfs/buninu/apps/bunmsh/test/serve/data.json +1 -0
  136. package/initramfs/buninu/apps/bunmsh/test/serve/data.json5 +1 -0
  137. package/initramfs/buninu/apps/bunmsh/test/serve/data.jsonc +2 -0
  138. package/initramfs/buninu/apps/bunmsh/test/serve/data.jsonl +2 -0
  139. package/initramfs/buninu/apps/bunmsh/test/serve/data.ndjson +1 -0
  140. package/initramfs/buninu/apps/bunmsh/test/serve/data.toml +3 -0
  141. package/initramfs/buninu/apps/bunmsh/test/serve/data.ts +15 -0
  142. package/initramfs/buninu/apps/bunmsh/test/serve/data.xml +1 -0
  143. package/initramfs/buninu/apps/bunmsh/test/serve/data.yaml +3 -0
  144. package/initramfs/buninu/apps/bunmsh/test/serve/data.yml +1 -0
  145. package/initramfs/buninu/apps/bunmsh/test/serve.test.js +241 -0
  146. package/initramfs/buninu/apps/bunmsh/test/shell.test.js +2092 -0
  147. package/initramfs/buninu/apps/bunmsh/test/shell1.test.js +1087 -0
  148. package/initramfs/buninu/apps/bunmsh/test/shell2.test.js +457 -0
  149. package/initramfs/buninu/apps/bunmsh/test/shell3.test.js +741 -0
  150. package/initramfs/buninu/apps/bunmsh/test/t.sh +12 -0
  151. package/initramfs/buninu/apps/bunx/bunx.js +172 -0
  152. package/initramfs/buninu/apps/cmdlist +48 -0
  153. package/initramfs/buninu/apps/jsgotty/LICENSE +23 -0
  154. package/initramfs/buninu/apps/jsgotty/LICENSES/Apache-2.0-zmodem.js.txt +201 -0
  155. package/initramfs/buninu/apps/jsgotty/NOTICE +21 -0
  156. package/initramfs/buninu/apps/jsgotty/README.en.md +294 -0
  157. package/initramfs/buninu/apps/jsgotty/README.md +296 -0
  158. package/initramfs/buninu/apps/jsgotty/client.mjs +700 -0
  159. package/initramfs/buninu/apps/jsgotty/env.sh +2 -0
  160. package/initramfs/buninu/apps/jsgotty/gotty.js +3334 -0
  161. package/initramfs/buninu/apps/jsgotty/node_modules/.package-lock.json +35 -0
  162. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/LICENSE.md +9 -0
  163. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/README.md +319 -0
  164. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/common.gypi +20 -0
  165. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/except.gypi +25 -0
  166. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/index.js +12 -0
  167. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
  168. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/napi-inl.h +6607 -0
  169. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/napi.h +3201 -0
  170. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/node_addon_api.gyp +32 -0
  171. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/node_api.gyp +9 -0
  172. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/noexcept.gypi +26 -0
  173. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/nothing.c +0 -0
  174. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/package-support.json +21 -0
  175. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/package.json +480 -0
  176. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/README.md +73 -0
  177. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/check-napi.js +99 -0
  178. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/clang-format.js +71 -0
  179. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/conversion.js +301 -0
  180. package/initramfs/buninu/apps/jsgotty/node_modules/node-addon-api/tools/eslint-format.js +79 -0
  181. package/initramfs/buninu/apps/jsgotty/node_modules/ws/LICENSE +20 -0
  182. package/initramfs/buninu/apps/jsgotty/node_modules/ws/README.md +548 -0
  183. package/initramfs/buninu/apps/jsgotty/node_modules/ws/browser.js +8 -0
  184. package/initramfs/buninu/apps/jsgotty/node_modules/ws/index.js +22 -0
  185. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/buffer-util.js +131 -0
  186. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/constants.js +19 -0
  187. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/event-target.js +292 -0
  188. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/extension.js +203 -0
  189. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/limiter.js +55 -0
  190. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/permessage-deflate.js +528 -0
  191. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/receiver.js +760 -0
  192. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/sender.js +607 -0
  193. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/stream.js +161 -0
  194. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/subprotocol.js +62 -0
  195. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/validation.js +152 -0
  196. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/websocket-server.js +562 -0
  197. package/initramfs/buninu/apps/jsgotty/node_modules/ws/lib/websocket.js +1407 -0
  198. package/initramfs/buninu/apps/jsgotty/node_modules/ws/package.json +70 -0
  199. package/initramfs/buninu/apps/jsgotty/node_modules/ws/wrapper.mjs +21 -0
  200. package/initramfs/buninu/apps/jsgotty/package-lock.json +46 -0
  201. package/initramfs/buninu/apps/jsgotty/package.json +19 -0
  202. package/initramfs/buninu/apps/jsgotty/patches/windowsPtyAgent.js +326 -0
  203. package/initramfs/buninu/apps/jsgotty/patches/windowsTerminal.js +204 -0
  204. package/initramfs/buninu/apps/jsgotty/rz.js +199 -0
  205. package/initramfs/buninu/apps/jsgotty/single-exe/README.md +384 -0
  206. package/initramfs/buninu/apps/jsgotty/single-exe/assetsHelper.js +371 -0
  207. package/initramfs/buninu/apps/jsgotty/single-exe/assetsLoader.mjs +85 -0
  208. package/initramfs/buninu/apps/jsgotty/single-exe/assetsPacker.js +218 -0
  209. package/initramfs/buninu/apps/jsgotty/single-exe/compiled.js +498 -0
  210. package/initramfs/buninu/apps/jsgotty/single-exe/entry.mjs +23 -0
  211. package/initramfs/buninu/apps/jsgotty/single-exe/packAssets.sh +7 -0
  212. package/initramfs/buninu/apps/jsgotty/static/css/index.css +13 -0
  213. package/initramfs/buninu/apps/jsgotty/static/css/kitty.css +61 -0
  214. package/initramfs/buninu/apps/jsgotty/static/css/xterm.css +218 -0
  215. package/initramfs/buninu/apps/jsgotty/static/css/xterm_customize.css +35 -0
  216. package/initramfs/buninu/apps/jsgotty/static/favicon.ico +0 -0
  217. package/initramfs/buninu/apps/jsgotty/static/help.md +125 -0
  218. package/initramfs/buninu/apps/jsgotty/static/icon.svg +66 -0
  219. package/initramfs/buninu/apps/jsgotty/static/icon_192.png +0 -0
  220. package/initramfs/buninu/apps/jsgotty/static/index.html +164 -0
  221. package/initramfs/buninu/apps/jsgotty/static/js/gotty.js +31537 -0
  222. package/initramfs/buninu/apps/jsgotty/static/js/gotty.js.LICENSE.txt +7 -0
  223. package/initramfs/buninu/apps/jsgotty/static/js/gotty.js.map +1 -0
  224. package/initramfs/buninu/apps/jsgotty/static/js/gotty.licenses.txt +650 -0
  225. package/initramfs/buninu/apps/jsgotty/static/js/kitty.js +1101 -0
  226. package/initramfs/buninu/apps/jsgotty/static/js/windows_bridge.js +194 -0
  227. package/initramfs/buninu/apps/jsgotty/static/js/xterm-addon-unicode11.js +2 -0
  228. package/initramfs/buninu/apps/jsgotty/static/js/zmodem.js +1 -0
  229. package/initramfs/buninu/apps/jsgotty/static/manifest.json +15 -0
  230. package/initramfs/buninu/apps/jsgotty/sz.js +273 -0
  231. package/initramfs/buninu/apps/jsgotty/tests/kitty-order.test.js +58 -0
  232. package/initramfs/buninu/apps/jsgotty/tests/websocket-origin.test.js +54 -0
  233. package/initramfs/buninu/apps/jsgotty/viu.mjs +422 -0
  234. package/initramfs/buninu/apps/jsgotty/wgotty +62 -0
  235. package/initramfs/buninu/apps/jsgotty/windows-bridge-node.js +60 -0
  236. package/initramfs/buninu/apps/jsgotty/zmodem-node.js +262 -0
  237. package/initramfs/buninu/apps/jsmdcui/CHANGELOG.md +1118 -0
  238. package/initramfs/buninu/apps/jsmdcui/LICENSE +22 -0
  239. package/initramfs/buninu/apps/jsmdcui/README.md +1283 -0
  240. package/initramfs/buninu/apps/jsmdcui/cdp-maze.js +141 -0
  241. package/initramfs/buninu/apps/jsmdcui/clean.sh +9 -0
  242. package/initramfs/buninu/apps/jsmdcui/demos/basic.jpg +0 -0
  243. package/initramfs/buninu/apps/jsmdcui/demos/chinese.md +32 -0
  244. package/initramfs/buninu/apps/jsmdcui/demos/event.md +170 -0
  245. package/initramfs/buninu/apps/jsmdcui/demos/good.jpg +0 -0
  246. package/initramfs/buninu/apps/jsmdcui/demos/image-processor.md +366 -0
  247. package/initramfs/buninu/apps/jsmdcui/demos/image-processor.zh-TW.md +366 -0
  248. package/initramfs/buninu/apps/jsmdcui/demos/img-change.md +73 -0
  249. package/initramfs/buninu/apps/jsmdcui/demos/imgtool-zh.md +298 -0
  250. package/initramfs/buninu/apps/jsmdcui/demos/imgtool.md +298 -0
  251. package/initramfs/buninu/apps/jsmdcui/demos/maze.md +149 -0
  252. package/initramfs/buninu/apps/jsmdcui/demos/reactive.md +40 -0
  253. package/initramfs/buninu/apps/jsmdcui/demos/reader.md +513 -0
  254. package/initramfs/buninu/apps/jsmdcui/demos/select.md +63 -0
  255. package/initramfs/buninu/apps/jsmdcui/demos/todo-zh.md +190 -0
  256. package/initramfs/buninu/apps/jsmdcui/demos/todo.md +191 -0
  257. package/initramfs/buninu/apps/jsmdcui/edit +9 -0
  258. package/initramfs/buninu/apps/jsmdcui/jsmdcui.sh +16 -0
  259. package/initramfs/buninu/apps/jsmdcui/llm-maze.txt +94 -0
  260. package/initramfs/buninu/apps/jsmdcui/package.json +29 -0
  261. package/initramfs/buninu/apps/jsmdcui/project_structure.txt +35 -0
  262. package/initramfs/buninu/apps/jsmdcui/runmd.mjs +1140 -0
  263. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/atom-dark.micro +33 -0
  264. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/bubblegum.micro +31 -0
  265. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/cmc-16.micro +47 -0
  266. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/cmc-tc.micro +43 -0
  267. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/darcula.micro +34 -0
  268. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/default.micro +1 -0
  269. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/dracula-tc.micro +49 -0
  270. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/dukedark-tc.micro +38 -0
  271. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/dukelight-tc.micro +38 -0
  272. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/dukeubuntu-tc.micro +38 -0
  273. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/geany.micro +29 -0
  274. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/gotham.micro +29 -0
  275. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/gruvbox-tc.micro +29 -0
  276. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/gruvbox.micro +26 -0
  277. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/material-tc.micro +36 -0
  278. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/monokai-dark.micro +28 -0
  279. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/monokai.micro +34 -0
  280. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/one-dark.micro +39 -0
  281. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/railscast.micro +37 -0
  282. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/simple.micro +33 -0
  283. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/solarized-tc.micro +31 -0
  284. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/solarized.micro +30 -0
  285. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/sunny-day.micro +29 -0
  286. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/twilight.micro +40 -0
  287. package/initramfs/buninu/apps/jsmdcui/runtime/colorschemes/zenburn.micro +30 -0
  288. package/initramfs/buninu/apps/jsmdcui/runtime/help/actions.md +161 -0
  289. package/initramfs/buninu/apps/jsmdcui/runtime/help/cdp.md +130 -0
  290. package/initramfs/buninu/apps/jsmdcui/runtime/help/colors.md +421 -0
  291. package/initramfs/buninu/apps/jsmdcui/runtime/help/commands.md +161 -0
  292. package/initramfs/buninu/apps/jsmdcui/runtime/help/copypaste.md +149 -0
  293. package/initramfs/buninu/apps/jsmdcui/runtime/help/defaultkeys.md +148 -0
  294. package/initramfs/buninu/apps/jsmdcui/runtime/help/help.md +1283 -0
  295. package/initramfs/buninu/apps/jsmdcui/runtime/help/keybindings.md +355 -0
  296. package/initramfs/buninu/apps/jsmdcui/runtime/help/linter.md +90 -0
  297. package/initramfs/buninu/apps/jsmdcui/runtime/help/options.md +709 -0
  298. package/initramfs/buninu/apps/jsmdcui/runtime/help/plugins.md +544 -0
  299. package/initramfs/buninu/apps/jsmdcui/runtime/help/tutorial.md +112 -0
  300. package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/cdp/cdp-server.js +1263 -0
  301. package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/cdp/cdp.js +203 -0
  302. package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/chapter/chapter.js +111 -0
  303. package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/diff/diff.js +46 -0
  304. package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/example/example.js +117 -0
  305. package/initramfs/buninu/apps/jsmdcui/runtime/jsplugins/linter/linter.js +281 -0
  306. package/initramfs/buninu/apps/jsmdcui/runtime/plugins/autoclose/autoclose.lua +75 -0
  307. package/initramfs/buninu/apps/jsmdcui/runtime/plugins/ftoptions/ftoptions.lua +17 -0
  308. package/initramfs/buninu/apps/jsmdcui/runtime/plugins/literate/README.md +5 -0
  309. package/initramfs/buninu/apps/jsmdcui/runtime/plugins/literate/literate.lua +55 -0
  310. package/initramfs/buninu/apps/jsmdcui/runtime/plugins/status/help/status.md +21 -0
  311. package/initramfs/buninu/apps/jsmdcui/runtime/plugins/status/status.lua +62 -0
  312. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/LICENSE +22 -0
  313. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/PowerShell.yaml +128 -0
  314. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/README.md +63 -0
  315. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ada.yaml +43 -0
  316. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/apacheconf.yaml +59 -0
  317. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/arduino.yaml +101 -0
  318. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/asciidoc.yaml +51 -0
  319. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/asm.yaml +123 -0
  320. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ats.yaml +99 -0
  321. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/awk.yaml +44 -0
  322. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/b.yaml +87 -0
  323. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/bat.yaml +57 -0
  324. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/c.yaml +60 -0
  325. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/caddyfile.yaml +23 -0
  326. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cake.yaml +7 -0
  327. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/clojure.yaml +38 -0
  328. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cmake.yaml +42 -0
  329. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/coffeescript.yaml +56 -0
  330. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/colortest.yaml +19 -0
  331. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/conky.yaml +17 -0
  332. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cpp.yaml +91 -0
  333. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/crontab.yaml +36 -0
  334. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/crystal.yaml +72 -0
  335. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/csharp.yaml +52 -0
  336. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/css.yaml +44 -0
  337. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/csx.yaml +8 -0
  338. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cuda.yaml +68 -0
  339. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/cython.yaml +52 -0
  340. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/d.yaml +121 -0
  341. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/dart.yaml +46 -0
  342. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/default.yaml +10 -0
  343. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/dockerfile.yaml +36 -0
  344. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/dot.yaml +29 -0
  345. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/elixir.yaml +30 -0
  346. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/elm.yaml +38 -0
  347. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/erb.yaml +42 -0
  348. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/erlang.yaml +45 -0
  349. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/fish.yaml +48 -0
  350. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/forth.yaml +34 -0
  351. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/fortran.yaml +64 -0
  352. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/freebsd-kernel.yaml +14 -0
  353. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/fsharp.yaml +48 -0
  354. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gdscript.yaml +61 -0
  355. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gemini.yaml +19 -0
  356. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gentoo-ebuild.yaml +48 -0
  357. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gentoo-etc-portage.yaml +23 -0
  358. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/git-commit.yaml +35 -0
  359. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/git-config.yaml +14 -0
  360. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/git-rebase-todo.yaml +19 -0
  361. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gleam.yaml +69 -0
  362. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/glsl.yaml +26 -0
  363. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gnuplot.yaml +15 -0
  364. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/go.yaml +62 -0
  365. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/godoc.yaml +17 -0
  366. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/golo.yaml +73 -0
  367. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/gomod.yaml +31 -0
  368. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/graphql.yaml +47 -0
  369. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/groff.yaml +30 -0
  370. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/groovy.yaml +111 -0
  371. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/haml.yaml +16 -0
  372. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/hare.yaml +52 -0
  373. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/haskell.yaml +52 -0
  374. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/hc.yaml +52 -0
  375. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/html.yaml +70 -0
  376. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/html4.yaml +25 -0
  377. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/html5.yaml +25 -0
  378. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ini.yaml +23 -0
  379. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/inputrc.yaml +14 -0
  380. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/java.yaml +37 -0
  381. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/javascript.yaml +124 -0
  382. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/jinja2.yaml +19 -0
  383. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/json.yaml +39 -0
  384. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/jsonnet.yaml +92 -0
  385. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/julia.yaml +57 -0
  386. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/justfile.yaml +40 -0
  387. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/keymap.yaml +27 -0
  388. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/kickstart.yaml +16 -0
  389. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/kotlin.yaml +66 -0
  390. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/kvlang.yaml +67 -0
  391. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ledger.yaml +14 -0
  392. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/lfe.yaml +17 -0
  393. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/lilypond.yaml +26 -0
  394. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/lisp.yaml +17 -0
  395. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/log.yaml +92 -0
  396. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/lua.yaml +111 -0
  397. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/mail.yaml +25 -0
  398. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/makefile.yaml +38 -0
  399. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/man.yaml +12 -0
  400. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/markdown.yaml +65 -0
  401. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/mc.yaml +23 -0
  402. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/meson.yaml +51 -0
  403. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/micro.yaml +34 -0
  404. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/mpdconf.yaml +13 -0
  405. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/msbuild.yaml +6 -0
  406. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nanorc.yaml +16 -0
  407. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nftables.yaml +30 -0
  408. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nginx.yaml +22 -0
  409. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nim.yaml +27 -0
  410. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nix.yaml +32 -0
  411. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/nu.yaml +114 -0
  412. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/objc.yaml +60 -0
  413. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ocaml.yaml +43 -0
  414. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/octave.yaml +83 -0
  415. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/odin.yaml +64 -0
  416. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/pascal.yaml +45 -0
  417. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/patch.yaml +14 -0
  418. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/peg.yaml +16 -0
  419. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/perl.yaml +58 -0
  420. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/php.yaml +60 -0
  421. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/pkg-config.yaml +12 -0
  422. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/po.yaml +12 -0
  423. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/pony.yaml +37 -0
  424. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/pov.yaml +21 -0
  425. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/privoxy-action.yaml +14 -0
  426. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/privoxy-config.yaml +10 -0
  427. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/privoxy-filter.yaml +12 -0
  428. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/proto.yaml +40 -0
  429. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/prql.yaml +84 -0
  430. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/puppet.yaml +22 -0
  431. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/python2.yaml +60 -0
  432. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/python3.yaml +80 -0
  433. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/r.yaml +32 -0
  434. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/raku.yaml +42 -0
  435. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/reST.yaml +18 -0
  436. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/renpy.yaml +15 -0
  437. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/rpmspec.yaml +43 -0
  438. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/ruby.yaml +73 -0
  439. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/rust.yaml +78 -0
  440. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sage.yaml +60 -0
  441. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/scad.yaml +53 -0
  442. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/scala.yaml +33 -0
  443. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sed.yaml +13 -0
  444. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sh.yaml +69 -0
  445. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sls.yaml +15 -0
  446. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/smalltalk.yaml +55 -0
  447. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/solidity.yaml +41 -0
  448. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/sql.yaml +35 -0
  449. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/stata.yaml +67 -0
  450. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/svelte.yaml +27 -0
  451. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/swift.yaml +103 -0
  452. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/systemd.yaml +16 -0
  453. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/tcl.yaml +18 -0
  454. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/terraform.yaml +87 -0
  455. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/tex.yaml +32 -0
  456. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/toml.yaml +56 -0
  457. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/twig.yaml +55 -0
  458. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/typescript.yaml +49 -0
  459. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/v.yaml +80 -0
  460. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/vala.yaml +26 -0
  461. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/verilog.yaml +60 -0
  462. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/vhdl.yaml +37 -0
  463. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/vi.yaml +31 -0
  464. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/vue.yaml +64 -0
  465. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/xml.yaml +37 -0
  466. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/xresources.yaml +14 -0
  467. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/yaml.yaml +34 -0
  468. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/yum.yaml +12 -0
  469. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/zig.yaml +52 -0
  470. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/zscript.yaml +72 -0
  471. package/initramfs/buninu/apps/jsmdcui/runtime/syntax/zsh.yaml +52 -0
  472. package/initramfs/buninu/apps/jsmdcui/single-exe/README.md +396 -0
  473. package/initramfs/buninu/apps/jsmdcui/single-exe/assetsHelper.js +371 -0
  474. package/initramfs/buninu/apps/jsmdcui/single-exe/assetsLoader.mjs +85 -0
  475. package/initramfs/buninu/apps/jsmdcui/single-exe/assetsPacker.js +218 -0
  476. package/initramfs/buninu/apps/jsmdcui/single-exe/compiled.js +498 -0
  477. package/initramfs/buninu/apps/jsmdcui/single-exe/entry.mjs +17 -0
  478. package/initramfs/buninu/apps/jsmdcui/single-exe/packAssets.sh +7 -0
  479. package/initramfs/buninu/apps/jsmdcui/src/MDCUI_DEFAULT_EDIT +0 -0
  480. package/initramfs/buninu/apps/jsmdcui/src/buffer/backup.js +165 -0
  481. package/initramfs/buninu/apps/jsmdcui/src/buffer/buffer.js +126 -0
  482. package/initramfs/buninu/apps/jsmdcui/src/buffer/fixed3-codec.js +140 -0
  483. package/initramfs/buninu/apps/jsmdcui/src/buffer/loc.js +38 -0
  484. package/initramfs/buninu/apps/jsmdcui/src/buffer/message.js +29 -0
  485. package/initramfs/buninu/apps/jsmdcui/src/build-args.js +40 -0
  486. package/initramfs/buninu/apps/jsmdcui/src/config/clean.js +172 -0
  487. package/initramfs/buninu/apps/jsmdcui/src/config/colorscheme.js +99 -0
  488. package/initramfs/buninu/apps/jsmdcui/src/config/config.js +125 -0
  489. package/initramfs/buninu/apps/jsmdcui/src/config/defaults.js +109 -0
  490. package/initramfs/buninu/apps/jsmdcui/src/cui/fence-events.mjs +144 -0
  491. package/initramfs/buninu/apps/jsmdcui/src/cui/heading-ids.mjs +1568 -0
  492. package/initramfs/buninu/apps/jsmdcui/src/cui/id-collision.mjs +111 -0
  493. package/initramfs/buninu/apps/jsmdcui/src/cui/identity.mjs +26 -0
  494. package/initramfs/buninu/apps/jsmdcui/src/cui/kitty-debug.mjs +25 -0
  495. package/initramfs/buninu/apps/jsmdcui/src/cui/kitty-images.mjs +280 -0
  496. package/initramfs/buninu/apps/jsmdcui/src/cui/kitty-mode.mjs +6 -0
  497. package/initramfs/buninu/apps/jsmdcui/src/cui/rerender-queue.mjs +66 -0
  498. package/initramfs/buninu/apps/jsmdcui/src/cui/rpc.mjs +1554 -0
  499. package/initramfs/buninu/apps/jsmdcui/src/cui/server.mjs +128 -0
  500. package/initramfs/buninu/apps/jsmdcui/src/cui/table-render.mjs +286 -0
  501. package/initramfs/buninu/apps/jsmdcui/src/cui/table-row-edit.mjs +226 -0
  502. package/initramfs/buninu/apps/jsmdcui/src/cui/task-checkbox.mjs +60 -0
  503. package/initramfs/buninu/apps/jsmdcui/src/cui/template-components.mjs +253 -0
  504. package/initramfs/buninu/apps/jsmdcui/src/cui/text-block-resize.mjs +177 -0
  505. package/initramfs/buninu/apps/jsmdcui/src/cui/tui-links.mjs +560 -0
  506. package/initramfs/buninu/apps/jsmdcui/src/display/ansi-style.js +60 -0
  507. package/initramfs/buninu/apps/jsmdcui/src/highlight/highlighter.js +243 -0
  508. package/initramfs/buninu/apps/jsmdcui/src/highlight/parser.js +225 -0
  509. package/initramfs/buninu/apps/jsmdcui/src/index.js +9586 -0
  510. package/initramfs/buninu/apps/jsmdcui/src/lua/engine.js +68 -0
  511. package/initramfs/buninu/apps/jsmdcui/src/platform/archive.js +50 -0
  512. package/initramfs/buninu/apps/jsmdcui/src/platform/clipboard.js +278 -0
  513. package/initramfs/buninu/apps/jsmdcui/src/platform/commands.js +221 -0
  514. package/initramfs/buninu/apps/jsmdcui/src/platform/terminal.js +5 -0
  515. package/initramfs/buninu/apps/jsmdcui/src/plugins/js-bridge.js +3377 -0
  516. package/initramfs/buninu/apps/jsmdcui/src/plugins/manager.js +674 -0
  517. package/initramfs/buninu/apps/jsmdcui/src/runtime/encodings.js +10 -0
  518. package/initramfs/buninu/apps/jsmdcui/src/runtime/registry.js +134 -0
  519. package/initramfs/buninu/apps/jsmdcui/src/screen/cell-buffer.js +81 -0
  520. package/initramfs/buninu/apps/jsmdcui/src/screen/events.js +263 -0
  521. package/initramfs/buninu/apps/jsmdcui/src/screen/screen.js +249 -0
  522. package/initramfs/buninu/apps/jsmdcui/src/screen/vt100.js +571 -0
  523. package/initramfs/buninu/apps/jsmdcui/src/shell/shell.js +70 -0
  524. package/initramfs/buninu/apps/jsmdcui/testapp.md +78 -0
  525. package/initramfs/buninu/apps/jsmdcui/tests/assets-helper.test.js +150 -0
  526. package/initramfs/buninu/apps/jsmdcui/tests/backup.test.js +158 -0
  527. package/initramfs/buninu/apps/jsmdcui/tests/cat-markdown.test.js +139 -0
  528. package/initramfs/buninu/apps/jsmdcui/tests/cdp-security.test.js +32 -0
  529. package/initramfs/buninu/apps/jsmdcui/tests/cdp-websocket-test.html +46 -0
  530. package/initramfs/buninu/apps/jsmdcui/tests/cmphex3b64.js +95 -0
  531. package/initramfs/buninu/apps/jsmdcui/tests/compiled-runtime.test.js +139 -0
  532. package/initramfs/buninu/apps/jsmdcui/tests/config-settings.test.js +52 -0
  533. package/initramfs/buninu/apps/jsmdcui/tests/demo.test.js +448 -0
  534. package/initramfs/buninu/apps/jsmdcui/tests/docs-sync.test.js +14 -0
  535. package/initramfs/buninu/apps/jsmdcui/tests/fence-events.test.js +1293 -0
  536. package/initramfs/buninu/apps/jsmdcui/tests/heading-ids.test.js +559 -0
  537. package/initramfs/buninu/apps/jsmdcui/tests/heading-list-selector.test.js +2393 -0
  538. package/initramfs/buninu/apps/jsmdcui/tests/id-collision.test.js +514 -0
  539. package/initramfs/buninu/apps/jsmdcui/tests/jmigt.js +16 -0
  540. package/initramfs/buninu/apps/jsmdcui/tests/js-plugin-prompts.test.js +110 -0
  541. package/initramfs/buninu/apps/jsmdcui/tests/key-event.md +10 -0
  542. package/initramfs/buninu/apps/jsmdcui/tests/kitty-demo.md +184 -0
  543. package/initramfs/buninu/apps/jsmdcui/tests/kitty-images.test.js +288 -0
  544. package/initramfs/buninu/apps/jsmdcui/tests/kitty-mode.test.js +14 -0
  545. package/initramfs/buninu/apps/jsmdcui/tests/platform-commands.test.js +18 -0
  546. package/initramfs/buninu/apps/jsmdcui/tests/platform-terminal.test.js +8 -0
  547. package/initramfs/buninu/apps/jsmdcui/tests/pty-demo.js +492 -0
  548. package/initramfs/buninu/apps/jsmdcui/tests/rerender-queue.test.js +130 -0
  549. package/initramfs/buninu/apps/jsmdcui/tests/table-render.test.js +150 -0
  550. package/initramfs/buninu/apps/jsmdcui/tests/table-row-edit.test.js +138 -0
  551. package/initramfs/buninu/apps/jsmdcui/tests/task-checkbox.test.js +33 -0
  552. package/initramfs/buninu/apps/jsmdcui/tests/template-components.test.js +422 -0
  553. package/initramfs/buninu/apps/jsmdcui/tests/text-block-resize.test.js +222 -0
  554. package/initramfs/buninu/apps/jsmdcui/tests/textarea.md +8 -0
  555. package/initramfs/buninu/apps/jsmdcui/tests/tui-links.test.js +298 -0
  556. package/initramfs/buninu/apps/jsmdcui/tests/wui-responsive-images.test.js +60 -0
  557. package/initramfs/buninu/apps/jsmdcui/tests/wui.test.js +108 -0
  558. package/initramfs/buninu/apps/jsmdcui/tests/wv-client.js +96 -0
  559. package/initramfs/buninu/apps/jsmdcui/tui +7 -0
  560. package/initramfs/buninu/apps/jsmdcui/wui +9 -0
  561. package/initramfs/buninu/apps/musl-la/LICENSES/GPL-3.0.txt +674 -0
  562. package/initramfs/buninu/apps/musl-la/LICENSES/gcc_runtime_exception.txt +73 -0
  563. package/initramfs/buninu/apps/musl-la/LICENSE_musl.txt +193 -0
  564. package/initramfs/buninu/apps/musl-la/NOTICE +41 -0
  565. package/initramfs/buninu/apps/musl-la/ld-musl-aarch64.so.1 +0 -0
  566. package/initramfs/buninu/apps/musl-la/libgcc_s.so.1 +0 -0
  567. package/initramfs/buninu/apps/musl-la/libstdc++.so.6 +0 -0
  568. package/initramfs/buninu/apps/musl-la/musl-la.sh +36 -0
  569. package/initramfs/buninu/apps/native-bridge/native-bridge.js +199 -0
  570. package/initramfs/buninu/apps/native-bridge/package.json +8 -0
  571. package/initramfs/buninu/apps/tts/tts.js +214 -0
  572. package/initramfs/buninu/apps/xclip/xclip.js +121 -0
  573. package/initramfs/buninu/apps/xdg-open/xdg-open.js +151 -0
  574. package/initramfs/buninu/bin/bun.bat +37 -0
  575. package/initramfs/buninu/bin/bun.sh +57 -0
  576. package/initramfs/buninu/bin/buninu-help.bat +4 -0
  577. package/initramfs/buninu/bin/buninu-help.sh +7 -0
  578. package/initramfs/buninu/bin/bunmsh.bat +3 -0
  579. package/initramfs/buninu/bin/bunmsh.sh +5 -0
  580. package/initramfs/buninu/bin/bunx.bat +3 -0
  581. package/initramfs/buninu/bin/glow.bat +3 -0
  582. package/initramfs/buninu/bin/glow.sh +5 -0
  583. package/initramfs/buninu/bin/init.js +779 -0
  584. package/initramfs/buninu/bin/install.js +570 -0
  585. package/initramfs/buninu/bin/jmi.bat +3 -0
  586. package/initramfs/buninu/bin/jmi.sh +5 -0
  587. package/initramfs/buninu/bin/jsgotty.bat +3 -0
  588. package/initramfs/buninu/bin/jsgotty.sh +5 -0
  589. package/initramfs/buninu/bin/jsmdcui.bat +11 -0
  590. package/initramfs/buninu/bin/libsh-loader.c +135 -0
  591. package/initramfs/buninu/bin/libsh-loader.so +0 -0
  592. package/initramfs/buninu/bin/multicall.sh +103 -0
  593. package/initramfs/buninu/bin/native-bridge.bat +3 -0
  594. package/initramfs/buninu/bin/rz.bat +3 -0
  595. package/initramfs/buninu/bin/rz.sh +5 -0
  596. package/initramfs/buninu/bin/shc.js +5 -0
  597. package/initramfs/buninu/bin/showimg.bat +3 -0
  598. package/initramfs/buninu/bin/showimg.sh +5 -0
  599. package/initramfs/buninu/bin/switch_to_android.sh +9 -0
  600. package/initramfs/buninu/bin/switch_to_linux.sh +7 -0
  601. package/initramfs/buninu/bin/sz.bat +3 -0
  602. package/initramfs/buninu/bin/sz.sh +5 -0
  603. package/initramfs/buninu/bin/tts.bat +3 -0
  604. package/initramfs/buninu/bin/xclip.bat +3 -0
  605. package/initramfs/buninu/bin/xdg-open.bat +3 -0
  606. package/initramfs/buninu/demo-server.js +64 -0
  607. package/initramfs/buninu/icon.png +0 -0
  608. package/initramfs/buninu/package.json +59 -0
  609. package/initramfs/etc/resolv.conf +1 -0
  610. package/initramfs/init.js +339 -0
  611. package/initramfs/lib/ld-musl-x86_64.so.1 +0 -0
  612. package/initramfs/lib/libc.musl-x86_64.so.1 +0 -0
  613. package/initramfs/lib/libgcc_s.so.1 +0 -0
  614. package/initramfs/lib/libstdc++.so.6 +0 -0
  615. package/initramfs/usr/bin/env +7 -0
  616. package/package.json +42 -0
  617. package/run-qemu.sh +44 -0
  618. package/scripts/fetch.sh +26 -0
  619. package/scripts/pack-initramfs.sh +41 -0
  620. package/test/build-init-bootstrap.sh +23 -0
  621. package/test/init-bootstrap.c +55 -0
@@ -0,0 +1,1283 @@
1
+ ![Demo](https://raw.githubusercontent.com/jjtseng93/jsmdcui/main/demo.jpg)
2
+
3
+ - Maze Game
4
+ * The TUI can be controlled through the Chrome DevTools Protocol (CDP). Codex successfully solved this maze using it.
5
+
6
+ ![Maze Game](https://raw.githubusercontent.com/jjtseng93/jsmdcui/main/maze.jpg)
7
+
8
+ # Demo App
9
+ ## My app
10
+
11
+ - [Say hello](javascript:sayHello())
12
+ - [Get server time](javascript:showServerTime())
13
+ - [Update text box](javascript:updateText())
14
+ - [Show selected](javascript:alert(JSON.stringify($('#my-app').val())))
15
+ - [x] task1
16
+ - [x] task2
17
+ - [ ] unselected task
18
+
19
+ ```text#myid.myclass
20
+ Editable in both TUI and WUI
21
+ ```
22
+
23
+ # Introduction
24
+ - jsmdcui stands for:
25
+ - JavaScript Markdown Cross-environment User Interface
26
+ - The goal is to use Markdown as a Common UI for Terminals and Web Browsers
27
+ * TUI = Terminal User Interface
28
+ * WUI = Web User Interface
29
+ - .
30
+ - Use a single Markdown file to build interactive TUI and Web UI apps in minutes, then compile them into [single-file executables](#distribution---build-single-file-executables) in seconds
31
+ - .
32
+ - It's based on bunmicro, a terminal text editor derived from the Micro text editor
33
+
34
+ - Original projects:
35
+ - https://github.com/jjtseng93/bunmicro
36
+ - https://github.com/micro-editor/micro
37
+ - .
38
+ - This README is itself a runnable app.
39
+
40
+ ```sh
41
+ npx jsmdcui@latest README.md
42
+ ```
43
+
44
+ ## Quick start
45
+
46
+ jsmdcui requires [Bun ≥ 1.3.12](https://bun.com).
47
+ On Android, install it in Termux:
48
+
49
+ ```sh
50
+ npm install -g bun
51
+ ```
52
+
53
+ On other platforms, follow the [official Bun installation guide](https://bun.com/docs/installation).
54
+
55
+ Choose either of these two ways to run jsmdcui.
56
+
57
+ > **Important:** Opening or rendering a local `.md` file writes or overwrites
58
+ > 5 generated files beside it.
59
+ > Starting `--wui` without a file or starting all the `--demo`s writes the
60
+ > 5 files generated from `testapp.md` in the current directory.
61
+ > The source Markdown is not changed, but you should run the demo in a directory where
62
+ > overwriting generated files is safe.
63
+
64
+ ### Route 1: Run with npx
65
+
66
+ - This route requires both `npx` and `bun` on your `PATH`; no source checkout is
67
+ required.
68
+
69
+ #### Open the normal terminal editor
70
+
71
+ ```sh
72
+ npx jsmdcui
73
+ ```
74
+
75
+ #### Start `testapp.md` as the TUI/WUI demo
76
+ - If `testapp.md` is missing, the bundled copy is written to the current working directory
77
+ - If `testapp.md` already exists, it will be used and won't be overwritten.
78
+
79
+ ```sh
80
+ # TUI(Terminal User Interface) Demo
81
+ npx jsmdcui --demo
82
+ ```
83
+
84
+ List every bundled demo and its command-line option:
85
+
86
+ ```sh
87
+ npx jsmdcui --demo-list
88
+ ```
89
+
90
+ ```sh
91
+ # Bun.Image processor demo
92
+ npx jsmdcui --demo-imgtool
93
+ ```
94
+
95
+ ```sh
96
+ # Traditional Chinese Bun.Image processor demo
97
+ npx jsmdcui --demo-imgtool-zh
98
+ ```
99
+
100
+ ```sh
101
+ # Maze game demo
102
+ npx jsmdcui --demo-maze
103
+ ```
104
+
105
+ ```sh
106
+ # Event context, heading references, and state demo
107
+ npx jsmdcui --demo-event
108
+ ```
109
+
110
+ ```sh
111
+ # Text-to-speech reader
112
+ npx jsmdcui --demo-reader
113
+ ```
114
+
115
+ To watch jsmdcui start the maze with a local CDP server and solve it
116
+ automatically after three seconds, run:
117
+
118
+ ```sh
119
+ npx jsmdcui --cdp-maze
120
+ ```
121
+
122
+ ```sh
123
+ # WUI(Web User Interface) Demo
124
+ npx jsmdcui --wui
125
+ ```
126
+
127
+ #### Open your own Markdown CUI App
128
+
129
+ ```sh
130
+ npx jsmdcui app.md
131
+ npx jsmdcui --wui app.md
132
+ ```
133
+
134
+ ### Route 2: Clone the source
135
+
136
+ ```sh
137
+ git clone https://github.com/jjtseng93/jsmdcui.git
138
+ cd jsmdcui
139
+ bun src/index.js testapp.md
140
+ ```
141
+
142
+ - The last command opens the included demo in the terminal
143
+ - Use arrow keys to move around
144
+ - `Enter`, `Space`, or mouse click to activate an item, and `Ctrl-Q` to quit.
145
+ - To open the same demo in a browser instead:
146
+
147
+ ```sh
148
+ bun src/index.js --wui testapp.md
149
+ ```
150
+
151
+ - After starting `--wui`, open the last printed `http://...` URL in a browser.
152
+ - Keep the command running while using the CUI App, and press `Ctrl-C` in that terminal to stop the server.
153
+
154
+ ### Usage table
155
+
156
+ - The command table below assumes you're running from a cloned repository
157
+ - If you use npx, replace `bun src/index.js` with `npx jsmdcui`
158
+
159
+ - I've also provided short aliases
160
+ * bun ./tui = bun src/index.js
161
+ * bun ./wui = bun src/index.js --wui
162
+
163
+ | Command | Result |
164
+ | --- | --- |
165
+ | `bun src/index.js app.md` | Render `app.md` as a read-only terminal UI and write five generated files beside it. |
166
+ | `bun src/index.js --kitty app.md` | Display Markdown images with Kitty graphics and the jsgotty MIME extension. |
167
+ | `bun src/index.js --kitty-compat app.md` | Convert Markdown images to PNG with `Bun.Image` and display them using the standard Kitty graphics protocol without the non-standard MIME `U` field. |
168
+ | `JSMDCUI_KITTY_MODE=compat bun src/index.js app.md` | Enable `compat` or `extended` Kitty mode without passing a Kitty command-line flag; the default and invalid values are `off`. |
169
+ | `bun src/index.js --kitty --allow-url URL.md` | Download trusted HTTP(S) Markdown and its HTTP(S) images, then display supported images with Kitty graphics. |
170
+ | `JSMDCUI_KITTY_DEBUG=1 bun src/index.js --kitty app.md` | Enable Kitty image placement logging to `kitty-placement.log`. |
171
+ | `bun src/index.js --check app.md` | Check heading and fenced-block IDs for collisions, print line-by-line details, and exit. |
172
+ | `bun src/index.js --outline app.md` | Print every heading and fenced-block ID without opening a UI or writing generated files. |
173
+ | `bun src/index.js --edit app.md` | Open `app.md` as editable UTF-8 source, overriding automatic Markdown UI detection. |
174
+ | `bun src/index.js --cat app.md` | Render the terminal version to stdout, write five generated files beside it, and exit. |
175
+ | `bun src/index.js --testapp.md` | Write the bundled `testapp.md` source to stdout and exit. |
176
+ | `bun src/index.js --export-readme` | Write or overwrite `./README.md` with the bundled README source and exit. |
177
+ | `bun src/index.js --export-cdp-maze` | Write or overwrite `./cdp-maze.js` with the bundled CDP maze solver and exit. |
178
+ | `bun src/index.js --demo-list` | List `testapp.md` and every bundled `demos/*.md` example with its command-line option, then exit. |
179
+ | `bun src/index.js --demo` | Use local `testapp.md` when present, otherwise write the bundled demo; open it in the terminal UI and write five generated files beside it. |
180
+ | `bun src/index.js --overwrite-demo --demo` | Replace an existing local `testapp.md` with the bundled copy before opening it. `--overwrite-demo` can modify any `--demo-*` option. |
181
+ | `bun src/index.js --demo-<filename>` | Load `demos/<filename>.md`; preserve an existing local copy or write the bundled copy, then open it and generate its five companion files. New files added under `demos/` work automatically. |
182
+ | `bun src/index.js --demo-imgtool` | Load the compact table-based Bun.Image processor demo. |
183
+ | `bun src/index.js --demo-imgtool-zh` | Load the Traditional Chinese table-based Bun.Image processor demo. |
184
+ | `bun src/index.js --demo-reader` | Load the text-to-speech reader demo. |
185
+ | `bun src/index.js --cdp-maze` | Load the maze demo, start CDP on `127.0.0.1:9222`, and run the bundled solver after three seconds. |
186
+ | `bun src/index.js --allow-url URL.md` | Download HTTP(S) Markdown to the current directory and, with Kitty mode enabled, download its HTTP(S) images; write 5 generated files and allow embedded code to run. Only use trusted URLs. |
187
+ | `bun src/index.js --wui` | Use local `testapp.md` when present, otherwise write the bundled demo; write five generated files in the current directory, then print and serve a random URL. |
188
+ | `bun src/index.js --wui app.md` | Write five generated files beside `app.md`, then print and serve a random URL. |
189
+ | `bun src/index.js --wui --demo-<filename>` | Load the selected bundled demo and serve it as a Web UI. |
190
+ | `bun src/index.js --wui --print-ui app.md` | Also print the generated TUI, raw ANSI, and HTML before starting the WUI server. |
191
+ | `PORT=8080 bun src/index.js --wui app.md` | Start the browser UI on another port. |
192
+ | `bun src/index.js` | Open the normal terminal editor with an empty buffer. |
193
+
194
+ Run `npx jsmdcui --help` or `bun src/index.js --help` for all command-line
195
+ options.
196
+
197
+ ## Write a Markdown UI
198
+
199
+ Create `app.md`:
200
+
201
+ ````md
202
+ ## My app
203
+
204
+ - [Say hello](javascript:sayHello())
205
+ - [Get server time](javascript:showServerTime())
206
+ - [Update text box](javascript:updateText())
207
+ - [Show selected](javascript:alert(JSON.stringify($('#my-app').val())))
208
+ - [x] task1
209
+ - [x] task2
210
+ - [ ] unselected task
211
+
212
+ ```text#myid.myclass
213
+ Editable in both TUI and WUI
214
+ ```
215
+
216
+ ```js front
217
+ export function sayHello() {
218
+ const name = prompt("Your name:", "World");
219
+ if (name) alert(`Hello, ${name}!`);
220
+ }
221
+
222
+ export async function showServerTime() {
223
+ const time = await rpc.getServerTime();
224
+ alert(time);
225
+ }
226
+
227
+ export function updateText() {
228
+ $('#myid').val($('.myclass').val() + ' ✓');
229
+ }
230
+ ```
231
+
232
+ ```js back
233
+ export function getServerTime() {
234
+ return new Date().toISOString();
235
+ }
236
+ ```
237
+ ````
238
+
239
+ Open it in either UI:
240
+
241
+ ```sh
242
+ bun src/index.js app.md
243
+ bun src/index.js --wui app.md
244
+ ```
245
+
246
+ - The resulting App UI is shown at the beginning of this README.md
247
+ - Run this demo app directly by:
248
+ * bun src/index.js README.md
249
+ * If you didn't clone the repo, use --export-readme to write README.md to the current folder
250
+
251
+ ### Text blocks
252
+
253
+ Both `text` and `textarea` fenced blocks define editable text fields:
254
+
255
+ ````md
256
+ ```text#message.note
257
+ Initial value
258
+ ```
259
+ ````
260
+
261
+ A fenced-block declaration must include a tag. Its supported identity syntax is
262
+ `tag`, optionally followed by `#id` and one or more `.class` names, for
263
+ example `text#message.note` or `textarea#notes.readonly`. Tags and class names
264
+ must begin with an ASCII letter or underscore; their remaining characters may
265
+ also include digits, `_`, `-`, and `:`. IDs may begin with `_` or a Unicode
266
+ letter or number; later characters may additionally be Unicode combining
267
+ marks, `_`, `-`, or `:`. Declarations such as `#message` and `#message.note`
268
+ have no tag and are therefore not recognized as selectable fenced blocks.
269
+
270
+ The currently supported fenced-block tags are only `text` and `textarea` so
271
+ the same control works consistently in both the TUI and WUI. Selector queries
272
+ may omit the tag or classes after a valid declaration, so all of
273
+ `$('text#message.note')`, `$('text#message')`, `$('#message.note')`, and
274
+ `$('#message')` can select the example above.
275
+
276
+ Named controls and their `@keydown` declarations are recognized inside
277
+ blockquotes and list items as well as at the top level.
278
+
279
+ The same Markdown works in both interfaces. In the browser WUI it becomes a
280
+ native `<textarea>` with the declared ID and classes. Long text wraps
281
+ automatically, and the field height is recalculated when the user types, the
282
+ window is resized, or frontend code calls `.val(value)`.
283
+
284
+ In the TUI, `text` remains a single-line control while `textarea` supports
285
+ native multiline editing. Enter splits the current body row and grows the
286
+ frame, Backspace at the start of a later row joins it to the previous row, and
287
+ Delete at the end of a row joins the following row. When the expanded control
288
+ does not fit on screen, the document viewport scrolls to keep the cursor
289
+ visible. The closing border and following Markdown content move with the
290
+ resized control.
291
+
292
+ A named `text` or `textarea` block can run inline front-end code before it
293
+ handles a key by placing a quoted HTML-style `@keydown` attribute after its
294
+ identity:
295
+
296
+ ````md
297
+ ```text#command.field @keydown="handleCommand(event)"
298
+ Initial value
299
+ ```
300
+
301
+ ```js front
302
+ export function handleCommand(event) {
303
+ if (event.key !== 'Enter') return;
304
+ event.preventDefault();
305
+ alert(`Command: ${$('#command').val()}`);
306
+ }
307
+ ```
308
+ ````
309
+
310
+ The block must have a unique ID. Both interfaces run the handler before their
311
+ normal text-editing behavior and expose a consistent key and modifier state.
312
+ The WUI also normalizes ordinary character input reported by software
313
+ keyboards.
314
+
315
+ On Android browsers, `Alt-E`, `Alt-N`, `Alt-U`, and `Alt-I` may be consumed or
316
+ transformed by the software keyboard and therefore cannot always be observed
317
+ reliably by a keydown handler. Avoid relying on these combinations for portable
318
+ WUI controls.
319
+
320
+ Both interfaces expose `event.key`, modifier flags, `event.target.id`, and
321
+ `event.target.value`. Use `event`, the native inline-handler variable, rather
322
+ than Vue's `$event` alias. Double quotes delimit the handler; use single-quoted
323
+ JavaScript strings inside it or escape an embedded double quote as `\"`.
324
+
325
+ Both interfaces add a non-enumerable `event.toJSON()` method with matching
326
+ keyboard, modifier, prevention, and target fields. `JSON.stringify(event)`
327
+ calls it automatically, so the resulting JSON is portable between the TUI and
328
+ WUI.
329
+
330
+ A keydown handler can call `event.preventDefault()` to stop text insertion or
331
+ cursor movement. The `.prevent` modifier applies this automatically:
332
+
333
+ ````md
334
+ ```text#command @keydown.prevent="handleCommand(event)"
335
+ ```
336
+ ````
337
+
338
+ Use `@input` when the handler needs the value after an edit has completed.
339
+ `@keydown` runs before the edit and can prevent it; `@input` runs after a
340
+ successful text change and receives the updated value. The WUI adds `oninput`
341
+ without replacing its existing `onkeydown` or mobile `onbeforeinput` handling.
342
+ The TUI also dispatches `@input` after editing or paste. Traditional terminal
343
+ input does not report physical key releases reliably, so jsmdcui does not
344
+ provide or emulate `@keyup` in either interface. See `demos/reactive.md` for a
345
+ complete cross-interface example.
346
+
347
+ In the terminal TUI, only content after the protected `│ ` or `| ` prefix can
348
+ be edited, and the frame prefix cannot be deleted. Multiline paste remains
349
+ blocked. For single-line `text` controls, activate the lower-left frame corner
350
+ to add a row. Activate the upper-left frame corner to remove the trailing row
351
+ only when it is empty; non-empty content is never removed.
352
+
353
+ TUI text-control changes made through `.val(value)` participate in the same
354
+ history as direct editing. `Ctrl-Z` undoes the replacement and `Ctrl-Y` redoes
355
+ it, including multiline frame resizing and its associated rendered metadata.
356
+
357
+ ### Heading task lists and selector API
358
+
359
+ Headings can act as form-group selectors. For example, `## Select Color`
360
+ becomes `#select-color`. When the usual generated ID would be empty, jsmdcui
361
+ normalizes the heading's visible Unicode text instead:
362
+ `## 使用者 設定!` becomes `#使用者-設定`. When normalization yields no usable
363
+ ID characters, the heading receives a stable `mdcui-h-...` fallback ID. A
364
+ heading referenced by app code should contain a meaningful letter or number;
365
+ treat `mdcui-h-...` as a fallback rather than hard-coding its hash. A heading
366
+ selection reads direct task items from the first list in the same Markdown
367
+ container after that heading. The search stops at the next heading or when the
368
+ enclosing blockquote or list item ends. In the TUI, the first rendered `☐` or
369
+ `☒` establishes that list and its indentation. Nested task items are not
370
+ included in the outer list's value.
371
+
372
+ Heading IDs share the same selector namespace as all explicitly named fenced
373
+ blocks, not only `text` and `textarea`, so avoid name collisions between them.
374
+ For example, `## Write Status` generates `#write-status` and must not be used
375
+ together with a block such as `text#write-status` or
376
+ `textarea#write-status`.
377
+ Otherwise, `$('#write-status')` may select the heading instead of the block and
378
+ updates can appear to do nothing. Rename either declaration so every
379
+ selectable ID is unique.
380
+
381
+ Duplicate source headings are treated as collisions when they generate the
382
+ same base ID. Give each heading a name that produces a unique ID; do not rely
383
+ on automatically added numeric suffixes.
384
+
385
+ Run `bun src/index.js --check app.md` (or `jsmdcui --check app.md`) to
386
+ check these IDs without opening either UI or writing generated files. The
387
+ command prints each collision with its source type, line number, and original
388
+ declaration, then exits immediately. Its exit status is `0` when all IDs are
389
+ unique, `1` when collisions are found, and `2` for invalid arguments or read
390
+ errors.
391
+
392
+ Run `bun src/index.js --outline app.md` (or `jsmdcui --outline app.md`) to
393
+ print the same selectable IDs as a compact outline. Heading IDs use indented
394
+ `-` items according to their heading level, while every named fenced block is
395
+ a top-level `+` item. Duplicate IDs are printed rather than treated as an
396
+ outline error; use `--check` when collisions should fail the command.
397
+
398
+ If the heading ID begins with `select`, `.val()` behaves like a single select:
399
+ it returns the first checked item or `null`. Other heading IDs behave like a
400
+ multiple select and return all checked items as an array, or `[]` when none are
401
+ checked.
402
+
403
+ Heading values contain the complete visible label, including any explanatory
404
+ text. When interpreting a selection, prefer `value.includes(...)` (or another
405
+ deliberate prefix/token parser) unless labels are guaranteed to be exact,
406
+ stable identifiers. For example, `yes(flip vertically)` should not be tested
407
+ with `value === "yes"`.
408
+
409
+ ````md
410
+ ## Select Color
411
+
412
+ - [ ] Red
413
+ - [x] Green
414
+ - [ ] Blue
415
+
416
+ ## Features
417
+
418
+ - [x] Search
419
+ - [ ] Notifications
420
+ - [x] Offline mode
421
+
422
+ ```js front
423
+ export function showValues() {
424
+ alert(JSON.stringify({
425
+ color: $('#select-color').val(),
426
+ features: $('#features').val(),
427
+ }));
428
+ }
429
+ ```
430
+ ````
431
+
432
+ The same getter works in TUI and WUI:
433
+
434
+ ```js
435
+ $('#select-color').val() // "Green"
436
+ $('#features').val() // ["Search", "Offline mode"]
437
+ ```
438
+
439
+ The first direct task list belonging to a heading can also be changed with
440
+ Array-style methods. String arguments create unchecked items. Pass an object
441
+ to choose the initial checked state:
442
+
443
+ ```js
444
+ $('#features').push('Export')
445
+ $('#features').unshift({ value: 'Import', checked: true })
446
+ $('#features').splice(1, 2, 'Replacement')
447
+ $('#features').slice(0, 2)
448
+ $('#features').pop()
449
+ $('#features').shift()
450
+ ```
451
+
452
+ Like the corresponding `Array.prototype` methods, `.push(...items)` and
453
+ `.unshift(...items)` accept multiple items and return the new number of direct
454
+ items. `.pop()` and `.shift()` return the removed item's visible label, or
455
+ `undefined` when the list is empty. Nested task items are part of their parent
456
+ item: they are not counted separately, and are removed together with that
457
+ parent. These methods change the rendered TUI/WUI state; they do not rewrite
458
+ the source Markdown file. A heading must already have a task list before items
459
+ can be added. If API mutations remove its final item, it still counts as that
460
+ heading's existing list, so a later `.push()` or `.unshift()` repopulates the
461
+ same position after hide/show, text-control row changes, or a TUI rerender.
462
+
463
+ `.splice(start, deleteCount, ...items)` follows `Array.prototype.splice()`:
464
+ negative indexes count from the end, omitting `deleteCount` removes through the
465
+ end, and the return value is an array containing the removed visible labels.
466
+
467
+ `.slice(start, end)` is read-only and follows `Array.prototype.slice()`. It
468
+ returns fresh item snapshots, including unchecked items, so changing the
469
+ returned array or its objects does not change the rendered list:
470
+
471
+ ```js
472
+ $('#features').slice()
473
+ // [
474
+ // { value: 'Search', checked: true },
475
+ // { value: 'Notifications', checked: false },
476
+ // ]
477
+ ```
478
+
479
+ `demos/todo.md` and `demos/todo-zh.md` are runnable Todo examples that
480
+ demonstrate `.push()`,
481
+ `.splice()`, `.slice()`, and `{ value, checked }` snapshots using editable text
482
+ controls instead of `prompt()` dialogs. Materialize one in the current
483
+ directory with its demo flag, or open the source-tree copy directly:
484
+
485
+ ```sh
486
+ bun src/index.js --demo-todo
487
+ bun src/index.js --demo-todo-zh
488
+ bun src/index.js demos/todo.md
489
+ bun src/index.js --wui demos/todo-zh.md
490
+ ```
491
+
492
+ The bundled `demos/select.md` is a multilevel runnable example. Use `--demo-select`
493
+ to write it into the current directory when missing and open it in the TUI, or
494
+ open it explicitly in either interface:
495
+
496
+ ```sh
497
+ bun src/index.js --demo-select
498
+ bun src/index.js demos/select.md
499
+ bun src/index.js --wui demos/select.md
500
+ ```
501
+
502
+ The available selector methods are:
503
+
504
+ `★★` means the API is intended for portable use in both the TUI and WUI.
505
+
506
+ > **Visibility requirement:** a selected heading and the content being changed
507
+ > must currently be shown before calling any update method, including `.data()`,
508
+ > `.val(value)`, `.text(value)`, task-list mutations, or table-cell setters.
509
+ > Updating content inside a hidden section is not supported and can appear to do
510
+ > nothing. Call `.show()` first, perform the update, and hide the section again
511
+ > afterward if necessary. Reads and visibility operations such as `.show()` are
512
+ > not subject to this update requirement.
513
+
514
+ | Method | TUI | WUI |
515
+ | --- | --- | --- |
516
+ | `★★ .id` | Return the selection's resolved ID; nested `$($($(selection)))` wrappers retain it. | Same. |
517
+ | `★★ .val()` | Read text blocks or heading task-list values. | Read textareas/controls or heading task-list values. |
518
+ | `★★ .val(value)` | Replace text-block contents, resize multiline values, and record Undo/Redo history. | Set textarea/control values and resize textareas. |
519
+ | `★★ .text()` | Return a heading's rendered visible text or an object target's `textContent`. Heading string-selector setters are intentionally unsupported. | Read an element's `textContent`; `.text(value)` also updates it. |
520
+ | `★★ .show()`, `.hide()`, `.toggle()` | Keep the heading visible and show or hide its section body. | Same. |
521
+ | `★★ .data()`, `.data(key, value)` | Read or update user data associated with the selection ID. | Same. |
522
+ | `★★ .removeData(...)` | Remove selected user keys or all user data without changing heading visibility. | Same. |
523
+ | `★★ .img(index = 0).src` | Return the indexed OSC 8 image address below a heading and before the next heading, or `""` when missing. | Return the indexed actual `<img>` element's current `src`, or `""` when missing. |
524
+ | `★★ .scrollIntoView(value)` | Move the heading cursor into view and align it to the top, center, or bottom of the current pane. | Call the heading element's native `scrollIntoView()` after translating the supported shortcuts. |
525
+ | `★★ .push(...items)` | Append unchecked strings or `{ value, checked }` task items; return the new direct-item count. | Same. |
526
+ | `★★ .pop()` | Remove and return the last direct task item's label, or `undefined`. | Same. |
527
+ | `★★ .shift()` | Remove and return the first direct task item's label, or `undefined`. | Same. |
528
+ | `★★ .unshift(...items)` | Prepend unchecked strings or `{ value, checked }` task items; return the new direct-item count. | Same. |
529
+ | `★★ .splice(start, deleteCount, ...items)` | Remove and insert direct task items; return the removed labels as an array. | Same. |
530
+ | `★★ .slice(start, end)` | Return `{ value, checked }` snapshots without changing the direct task items. | Same. |
531
+ | `★★ .cell(row, col).text()` | Read a heading-associated table cell using zero-based coordinates. Wrapped visual lines are joined without a separator. | Read the corresponding `th` or `td` text. |
532
+ | `★★ .cell(row, col).text(value)` | Replace text within the cell's available space; excess text is truncated while table borders, formatting, and links stay intact. | Replace cell text while retaining existing elements such as links. |
533
+ | `★★ .cell(row, col).val()` | Return `true` or `false` for the first `☒` or `☐` in the cell; if there is no checkbox, return the cell text. | Return the first checkbox input's checked state, or the cell text when none exists. |
534
+ | `★★ .cell(row, col).val(checked)` | Set the first checkbox in the cell from a boolean value. A cell without a checkbox is unchanged. | Same. |
535
+ | `★★ .cell(...).row`, `.col`, `.left()`, `.right()`, `.up()`, `.down()` | Inspect zero-based cell coordinates or move to a physical neighbor. `.lt()`, `.rt()`, and `.dn()` are aliases. Moving outside the table returns `null`. | Same. |
536
+ | `★★ .parent()` | From a link event's `$(this)`, return its containing table cell, or `null`. | From an element inside `th` or `td`, return the same cell selection. |
537
+ | `.html()` | For a heading selector, return its rendered inline HTML from the source Markdown. For an object target, read that object's own `innerHTML` property. There is no TUI DOM. | Return any successfully selected DOM element's actual `innerHTML`. |
538
+ | `.line()` | Return a heading's current 1-based TUI row, or `0` if missing. | Not available. |
539
+
540
+ Heading `scrollIntoView()` accepts the browser boolean forms plus three numeric
541
+ shortcuts. With no argument it aligns to the top. `true` and `-1` mean top;
542
+ `0` means center; `false` and `1` mean bottom. Any other first argument falls
543
+ back to center, and additional arguments are ignored:
544
+
545
+ ```js
546
+ $('#result').scrollIntoView() // top
547
+ $('#result').scrollIntoView(true) // top
548
+ $('#result').scrollIntoView(-1) // top
549
+ $('#result').scrollIntoView(0) // center
550
+ $('#result').scrollIntoView(1) // bottom
551
+ $('#result').scrollIntoView(false)// bottom
552
+ $('#result').scrollIntoView({}) // center fallback
553
+ ```
554
+
555
+ At the start of any Markdown table cell, `[ ]` and `[x]` (or `[X]`) become
556
+ unchecked and checked controls. The TUI displays `☐` or `☒` without changing
557
+ the row layout and colors checked `☒` green like Bun task lists; the WUI
558
+ creates a native `<input type="checkbox">`. The same text elsewhere in a cell
559
+ is left unchanged. Use `.cell(row, col).val()` when application code needs the
560
+ checked state. WUI table cells are directly editable; programmatic changes can
561
+ still use `.cell(row, col).text(value)`.
562
+
563
+ Every `$()` selection exposes its resolved `.id`. Passing an object with a
564
+ legal MDCUI ID immediately canonicalizes it to the same path as `$('#id')`.
565
+ The original object's other fields are not retained, so repeated wrapping
566
+ follows that ID path at any nesting depth. Objects without a legal ID keep
567
+ their generic object-target behavior:
568
+
569
+ ```js
570
+ const source = { id: 'features', value: 'ignored after selection' }
571
+ const heading = $(source) // exactly the same target as $('#features')
572
+ source.id = 'something-else' // does not retarget heading
573
+ const nested = $($($($(heading))))
574
+
575
+ nested.id // "features"
576
+ nested.text()
577
+ nested.data() === heading.data()
578
+ ```
579
+
580
+ User data belongs to the resolved ID and remains available while the document
581
+ is open, including when the corresponding WUI element is temporarily replaced.
582
+ Calling `.removeData()` does not change heading visibility.
583
+
584
+ ### Reactive Markdown templates
585
+
586
+ For React and Vue users, the closest mental model is a heading-scoped component
587
+ with shared state: the Markdown heading owns the data, each exactly
588
+ four-backtick `md template` or `js template` fence below it is a rendered view,
589
+ and the next heading starts a new scope. Templates under the same heading
590
+ therefore read and react to the same data object; templates under another
591
+ heading do not.
592
+
593
+ An `md template` source is automatically treated as a JavaScript template
594
+ literal. A `js template` source is instead used directly as a synchronous
595
+ render function body and must explicitly return Markdown, for example with a
596
+ `return` statement and a template literal. Both forms use the same component
597
+ and rendering pipeline; `js template` does not support async rendering yet.
598
+
599
+ The optional YAML front matter at the beginning of a template provides its
600
+ initial values, comparable to Vue's initial `data()` or React's initial state.
601
+ jsmdcui parses it with `Bun.YAML` and merges it into the owning heading's data
602
+ before any component performs its first render. The parsed values also remain
603
+ available as that component's `initialData`. Front matter is recognized only
604
+ when the first line and a later closing line are both exactly `---`.
605
+
606
+ Inside a template, `data` is the owning heading's `.data()` object and acts as
607
+ heading-scoped reactive state, similar to Vue reactive state or React component
608
+ state. To update it and trigger rendering, call the heading selector's
609
+ `.data(key, value)` or `.data(object)`.
610
+ For example, updating `$('#profile')` updates the state owned by the `profile`
611
+ heading. jsmdcui then automatically calls every template component under that
612
+ heading and replaces its rendered region in both the TUI and WUI; application
613
+ code does not call `render()` manually. Async updates from timers and promises
614
+ also request an immediate TUI redraw.
615
+
616
+ This is deliberately simpler than React reconciliation or Vue dependency
617
+ tracking: a heading data setter rerenders all template components owned by that
618
+ heading. Each render returns Markdown, which jsmdcui converts through the
619
+ appropriate in-memory TUI or WUI Markdown step before replacing only that
620
+ component's region.
621
+
622
+ During rendering, `this` is the template component instance. It exposes
623
+ `source`, `templateType`, `initialData`, `last`, `data`, `id`, `index`, and
624
+ `render(data = {})`; `this.id` is the owning heading ID and `this.data` is the
625
+ same shared object passed as `data`. A `js template` can use `this.id` to
626
+ identify its heading scope while implementing more dynamic render logic.
627
+
628
+ The full syntax and working input binding are kept in `demos/reactive.md` and `demos/reader.md` so
629
+ this runnable README does not declare a template component of its own.
630
+
631
+ For the detailed bilingual example with a text field and 200 ms debounce, read
632
+ `demos/reactive.md` or run it in either interface:
633
+
634
+ ```sh
635
+ bun src/index.js --demo-reactive
636
+ bun src/index.js --wui --demo-reactive
637
+ ```
638
+
639
+ ### Heading visibility boundaries
640
+
641
+ `$('#topic').hide()` keeps the heading visible and hides its content through the
642
+ next heading of equal or higher level, or through the end of its enclosing
643
+ blockquote or list item, whichever comes first. Lower-level headings and their
644
+ content belong to that section. `.show()` reveals it, and `.toggle()` switches
645
+ between the two states in both interfaces.
646
+
647
+ The first visible character of an identified Markdown heading is also a fixed
648
+ toggle target. Activate it with a mouse click, `Enter`, or `Space`. Markdown
649
+ headings always receive a nonempty ID.
650
+
651
+ Raw HTML headings follow interface-native behavior instead. In the WUI, an
652
+ `h1`-`h6` with a nonempty `id` remains a DOM heading and receives a toggle; a
653
+ legal MDCUI ID also makes it selectable through `$()`. The TUI renders raw HTML
654
+ as literal text, so it is not a TUI heading selector or toggle target. Raw
655
+ heading IDs are still included in `--check` collision detection.
656
+
657
+ To change a TUI task list, its heading must be visible and must already contain
658
+ a direct task list. Otherwise the mutation returns its normal empty result
659
+ without changing a child heading's list or creating a new one.
660
+
661
+ ### Event context
662
+
663
+ A local `javascript:` Markdown link runs with a link-shaped `this` and matching
664
+ event targets in both interfaces:
665
+
666
+ ```md
667
+ [Inspect](javascript:inspect(this,event))
668
+ ```
669
+
670
+ ```js
671
+ export function inspect(target, event) {
672
+ console.log($(target).text())
673
+ console.log($(event.target).text())
674
+ console.log(event.type)
675
+ console.log(event.target === target)
676
+ console.log(event.currentTarget === target)
677
+ }
678
+ ```
679
+
680
+ For a TUI OSC 8 link, jsmdcui provides an anchor-like target containing
681
+ `tagName`, `href`, `textContent`, and `innerHTML`. Wrapped links remain active
682
+ on every displayed row. When jsmdcui can match the link to the current Markdown
683
+ source, `innerHTML` contains rendered inline HTML for its label; otherwise it
684
+ falls back to `textContent`. Mouse activation reports
685
+ `event.type === "click"`. `Enter` and `Space` report
686
+ `event.type === "keydown"` with standard `event.key` values. In the WUI, the
687
+ native anchor is used as `this` and as both event targets.
688
+
689
+ Fence keydown code may likewise receive both values explicitly:
690
+
691
+ ````md
692
+ ```text#command @keydown.prevent="handleKey(this,event)"
693
+ Focus here
694
+ ```
695
+ ````
696
+
697
+ Both interfaces bind the control as `this`, `event.target`, and
698
+ `event.currentTarget`. The TUI target is synthetic and provides a live
699
+ `value`; the WUI target is the native `<textarea>`.
700
+
701
+ For a complete interactive example in either interface, run:
702
+
703
+ ```sh
704
+ bun src/index.js --demo-event
705
+ bun src/index.js --wui --demo-event
706
+ ```
707
+
708
+ The demo reports results in its bottom **Output Console** and covers link
709
+ `this`, event targets, keyboard fields, nested `$()` selections, heading data,
710
+ and heading visibility.
711
+
712
+ ### TUI resize behavior
713
+
714
+ Changing terminal or split width rerenders MDCUI while preserving heading
715
+ visibility, task-list changes, edited table cells, checkbox state, and
716
+ fenced-control contents. Edited cell text is fitted into the resized table and
717
+ is truncated only when the new cell is too small. Multiline `.val(value)`
718
+ changes also update later heading positions.
719
+
720
+ The 3 UI building blocks are:
721
+
722
+ - 1. `Regular Markdown` provides headings, text, lists, task checkboxes, code, and
723
+ links.
724
+ - 2. `js front` block contains UI code. Exported functions can use
725
+ `alert`, `confirm`, `prompt`, and the generated `rpc` client.
726
+ * A front module may export `async function onMdcuiLoad()`.
727
+ * It runs once after the TUI has completed startup layout and rendering, or
728
+ after the WUI `window.load` event and installation of jsmdcui's browser
729
+ selectors and template store.
730
+ * A front module may export `async function onMdcuiExit({ reason, path, $ })`.
731
+ * The terminal UI awaits it before closing an `mdcui` buffer.
732
+ * Modified `mdcui` buffers close without a save prompt.
733
+ - 3. `js back` block exports trusted backend functions. In the browser WUI,
734
+ `rpc` publishes only exported functions whose exported names do not start
735
+ with `_`. Call a published function from the front end with
736
+ `await rpc.functionName(arg1, arg2)`.
737
+
738
+ Front code can use `await $.tts(text, pitch, speed)` to speak a sentence and
739
+ wait until it finishes. In the TUI, supplied pitch and speed values update
740
+ `TTS_PITCH` and `TTS_SPEED` for the current jsmdcui process only; they are not
741
+ persisted after exit. In the WUI, the same call uses the browser Web Speech API.
742
+ Successful calls resolve to `undefined`; WUI failures resolve to an error-reason
743
+ string instead of rejecting, so callers may inspect the awaited return value.
744
+ Call `await $.tts.stop()` to stop speech. In the TUI this uses the dedicated TTS
745
+ stop path; in the WUI it cancels browser speech synthesis. Pressing Escape in
746
+ the TUI also uses that same dedicated stop path while speech is active.
747
+
748
+ > An `_` prefix only hides a function from the browser WUI RPC interface. The
749
+ > local terminal UI imports the backend module directly, so `_` is a naming
750
+ > convention, not authentication or a security boundary. Use a name without
751
+ > `_` for a function that must work through RPC in both UIs.
752
+
753
+ Use a `javascript:` Markdown link to run front-end code:
754
+
755
+ ```md
756
+ [Button label](javascript:exportedFunction())
757
+ ```
758
+
759
+ Use `onMdcuiExit` when a terminal Markdown app needs to submit or otherwise
760
+ process edited fields before it closes:
761
+
762
+ ```js
763
+ export async function onMdcuiExit({ reason, path, $ }) {
764
+ await rpc.saveDraft({
765
+ reason,
766
+ path,
767
+ message: $('#message').val(),
768
+ });
769
+ }
770
+ ```
771
+
772
+ The callback is optional, may be asynchronous, and is called at most once for
773
+ each mdcui buffer.
774
+
775
+ The front and back code blocks are not shown in the rendered UI. The generated
776
+ `rpc` client presents the same exported backend functions in both interfaces.
777
+
778
+ ## Terminal interaction
779
+
780
+ Markdown files automatically use `mdcui` mode. Most rendered content remains
781
+ protected, while `text` block content rows can be edited. Navigation,
782
+ selection, search, and copy remain available.
783
+
784
+ | Input | Result |
785
+ | --- | --- |
786
+ | Arrow keys, `Home`, `End`, `PageUp`, `PageDown` | Move through the rendered UI. |
787
+ | `Enter` or `Space` | Activate the cell under the cursor. A `javascript:` link runs, a `#heading-id` link jumps to and centers that heading, and `☐` or `☒` toggles when activated on or to its right. |
788
+ | Left click | Move to and activate the clicked cell. `javascript:` and `#heading-id` links follow the same behavior; clicking on or to the right of `☐` or `☒` toggles that task. |
789
+ | Mouse wheel | Scroll three rows at a time. |
790
+ | `Shift` + arrow keys | Select rendered text. |
791
+ | `Ctrl-C` | Copy the selection, or the current line when nothing is selected. |
792
+ | `Ctrl-A` | Select all rendered text. |
793
+ | `Ctrl-F` | Search; use `Ctrl-N` and `Ctrl-P` for the next and previous match. |
794
+ | `Ctrl-G` | Open the editor help. |
795
+ | `Alt-G` | Show or hide the shortcut bar. |
796
+ | `Ctrl-Q` or `Alt-Q` | Close the current UI. |
797
+
798
+ To preview another color theme, press `Ctrl-E` or click on `€`, type `theme `, then use `Tab`
799
+ and the arrow keys to browse the available themes. Press `Enter` to switch to
800
+ the selected theme, or `Esc` to cancel and restore the previous one.
801
+
802
+ The terminal automatically reflows the Markdown when its width changes.
803
+ Same-document links such as `[Jump](#target-heading)` navigate to Markdown
804
+ heading IDs in the TUI. Only `javascript:` links execute code there; ordinary
805
+ web links behave as normal links in the browser.
806
+
807
+ Local Markdown images are displayed automatically in terminals that support
808
+ the Kitty graphics protocol. Relative image paths are resolved from the
809
+ Markdown file's directory. jsmdcui reads the image dimensions, reserves the
810
+ corresponding terminal rows, and updates the placement when the document is
811
+ scrolled, resized, or shown in a split pane. Unsupported or missing images, as
812
+ well as remote images not authorized with `--allow-url`, retain Bun's normal
813
+ linked `📷` fallback. All remote images in one TUI render share a 10-second
814
+ download budget; timed-out images are aborted and keep the same fallback. To
815
+ download trusted remote Markdown and display its supported HTTP(S) images with
816
+ Kitty graphics, combine the options:
817
+
818
+ ```sh
819
+ bun src/index.js --kitty --allow-url https://example.com/app.md
820
+ ```
821
+
822
+ Images referenced by an app built with `--build-md-exe` are embedded and remain
823
+ available to both the compiled WUI and Kitty-capable TUI. No second asset copy
824
+ is required.
825
+
826
+ To make a no-argument compiled app enable standard Kitty-compatible rendering
827
+ immediately, inline the environment-mode value at build time:
828
+
829
+ ```sh
830
+ npx jsmdcui --build-md-exe myapp.md \
831
+ --define process.env.JSMDCUI_KITTY_MODE=compat
832
+ ```
833
+
834
+ For the jsgotty MIME extension, use `extended` instead:
835
+
836
+ ```sh
837
+ npx jsmdcui --build-md-exe myapp.md \
838
+ --define process.env.JSMDCUI_KITTY_MODE=extended
839
+ ```
840
+
841
+ Use the global expression `process.env.JSMDCUI_KITTY_MODE` exactly as shown;
842
+ do not import or alias `process`, because build-time definitions match that
843
+ expression.
844
+
845
+ ### CDP control for TUI automation
846
+
847
+ The terminal UI can expose a Chrome DevTools Protocol (CDP) server, so another
848
+ Bun process can inspect the terminal buffer, click buffer coordinates, and send
849
+ real keyboard events to the running TUI.
850
+
851
+ Start CDP from the command line when launching jsmdcui:
852
+
853
+ ```sh
854
+ bun src/index.js --remote-debugging-port=9222 demos/maze.md
855
+ bun src/index.js --remote-debugging-port=9222 --remote-debugging-address=127.0.0.1 demos/maze.md
856
+ ```
857
+
858
+ Or start it from inside the TUI editor command prompt(Ctrl-E or €):
859
+
860
+ ```text
861
+ Ctrl-E cdp
862
+ Ctrl-E cdp 9000
863
+ Ctrl-E cdp --address=127.0.0.1
864
+ Ctrl-E cdp 9000 --public
865
+ ```
866
+
867
+ The default bind address is `127.0.0.1` and the default port is `9222`.
868
+ Use `--public` or `--address=0.0.0.0` only on a trusted network.
869
+
870
+ Like Chromium, jsmdcui rejects WebSocket connections carrying an `Origin`
871
+ header by default. This prevents ordinary web pages from controlling the TUI.
872
+ Non-browser automation clients, which omit `Origin`, continue to work. To
873
+ explicitly allow a trusted browser origin, use a comma-separated allowlist:
874
+
875
+ ```sh
876
+ bun src/index.js --remote-debugging-port=9222 \
877
+ --remote-allow-origins=http://localhost:8000 demos/maze.md
878
+ ```
879
+
880
+ `--remote-allow-origins=*` disables this protection and should only be used in
881
+ a trusted environment. CDP can evaluate JavaScript and has the same authority
882
+ as the jsmdcui process.
883
+
884
+ Once CDP is running, control the TUI with `Bun.WebView`. For more info, enter
885
+ jsmdcui and use `Ctrl-E` or `€` → `help cdp`.
886
+
887
+ The cli flag `--cdp-maze` is a combination of
888
+ 1. Start the demos/maze.md
889
+ 2. Start a local CDP server
890
+ 3. Wait three seconds
891
+ 4. Run the solver cdp-maze.js automatically
892
+
893
+ The solver was
894
+ generated from the `llm-maze.txt` instructions; it focuses the maze controls,
895
+ resets the game, reads the maze from the TUI, solves it with breadth-first
896
+ search, and sends arrow-key input until the maze is escaped:
897
+
898
+ ```sh
899
+ npx jsmdcui@latest --cdp-maze
900
+ ```
901
+
902
+ From the source tree, run:
903
+
904
+ ```sh
905
+ bun src/index.js --cdp-maze
906
+ ```
907
+
908
+ Useful automation methods used by `cdp-maze.js`:
909
+
910
+ - `view.evaluate(js)`
911
+ - `view.evaluate("micro.getAllText()")`
912
+ - `view.evaluate("micro.getAllAnsiText()")`
913
+ - `view.click(column, line)`
914
+ - `view.press(key, options)`
915
+
916
+ ## Browser interaction
917
+
918
+ The WUI uses normal browser mouse and keyboard behavior. Clicking a
919
+ `javascript:` link calls its front-end function, regular links navigate
920
+ normally, and task checkboxes can be toggled by clicking either the checkbox or
921
+ its associated text. `alert`, `confirm`, and `prompt` use the browser's built-in
922
+ dialogs. Checkbox changes exist only in the current page: refreshing does not
923
+ preserve them and does not update the Markdown file.
924
+
925
+ The WUI first tries port `3000` and accepts connections through the machine's
926
+ available network interfaces. If port `3000` is already in use, the operating
927
+ system selects an available port instead; the printed URL always contains the
928
+ actual port. Set `PORT` to request another fixed port. The printed `localhost`
929
+ URL is for the same machine. From another device on the same network, replace
930
+ `localhost` with the server machine's IP address and keep the printed port and
931
+ full path.
932
+
933
+ Each server start prints a new random path. The old URL stops working after the
934
+ server is stopped or restarted. Keep the process running while using the page,
935
+ and press `Ctrl-C` in its terminal to stop it.
936
+
937
+ ## Reactive images
938
+
939
+ > **The reactive image heading must be visible when it is updated.** Calling
940
+ > `.data('img', source)` while that heading or one of its containing sections is
941
+ > hidden will not refresh the image. Show the heading first, update its data,
942
+ > then scroll to or hide it as needed:
943
+
944
+ ```js
945
+ const preview = $('#myimg')
946
+ preview.show()
947
+ preview.data('img', resolvedSource)
948
+ preview.scrollIntoView()
949
+ ```
950
+
951
+ - Use the heading image selector to obtain an image source:
952
+
953
+ ```js
954
+ $('#myimg').img().src
955
+ ```
956
+
957
+ - The index is zero-based and defaults to `0`.
958
+ - In the WUI, `src` comes from the actual `<img>`
959
+ element.
960
+ - In the TUI, it is the image address stored in the rendered OSC 8 link below that heading and before the next heading.
961
+
962
+ - Don't use relative paths when updating reactive md/js template images with .data
963
+ * Only use it in the initial markdown
964
+ * The WUI goes through Bun's standalone HTML bundler, which may embed an image and rewrite its simple relative path once the server started
965
+ * Therefore, do not update a template image by assigning a path such as `basic.jpg` directly.
966
+ * Read the bundled or otherwise resolved source
967
+ through `$(heading).img(index).src`, save it, and pass that value to `.data('img',src)`.
968
+
969
+ - Images not intended to be visible initially must still appear in the Markdown so Bun can discover and embed them.
970
+ - Put those images under a separate heading such as hidden and read their resolved sources during `onMdcuiLoad()`, and then hide that heading:
971
+
972
+ ````md
973
+ # myimg
974
+
975
+ - four-backtick md template starts here
976
+ ---
977
+ img: basic.jpg
978
+ ---
979
+ ![demo](${data.img})
980
+ - four-backtick md template ends here
981
+
982
+ - [Change picture](javascript:changePicture())
983
+
984
+ # hidden
985
+
986
+ ![alternate](good.jpg)
987
+
988
+ ```js front
989
+ let imageSources = []
990
+ let imageIndex = 0
991
+
992
+ export function onMdcuiLoad()
993
+ {
994
+ imageSources = [
995
+ $('#myimg').img(0).src,
996
+ $('#hidden').img(0).src,
997
+ ].filter(Boolean)
998
+ $('#hidden').hide()
999
+ }
1000
+
1001
+ export function changePicture()
1002
+ {
1003
+ if (imageSources.length < 2) return
1004
+ imageIndex = (imageIndex + 1) % imageSources.length
1005
+ $('#myimg').data('img', imageSources[imageIndex])
1006
+ }
1007
+ ```
1008
+ ````
1009
+
1010
+ - This keeps both images available to Bun's bundler, while exposing only the reactive image heading to the user.
1011
+
1012
+ You can also pass a complete image data URL to a reactive template through
1013
+ `.data()`. In that case, read the file in a `js back` function, convert its
1014
+ bytes to Base64, and return the data URL through `rpc`.
1015
+
1016
+ For example, put this code in a `js back` fence:
1017
+
1018
+ ```js
1019
+ import { readAssetBytes } from './single-exe/assetsHelper.js'
1020
+
1021
+ export async function readImageDataUrl(path)
1022
+ {
1023
+ const bytes = await readAssetBytes(path)
1024
+ return `data:image/jpeg;base64,${Buffer.from(bytes).toString('base64')}`
1025
+ }
1026
+ ```
1027
+
1028
+ Then put this code in the `js front` fence. The RPC result can be assigned
1029
+ directly to the template's `img` data property:
1030
+
1031
+ ```js
1032
+ export async function onMdcuiLoad()
1033
+ {
1034
+ const src = await rpc.readImageDataUrl('demos/basic.jpg')
1035
+ $('#myimg').data('img', src)
1036
+ }
1037
+ ```
1038
+
1039
+ The value must contain the complete prefix, such as
1040
+ `data:image/jpeg;base64,`. A raw Base64 payload alone is not an image data URL.
1041
+ This method does not require a hidden Markdown image because the image bytes
1042
+ are loaded explicitly. When building a standalone executable, make sure the
1043
+ file is either present in `internalAssets` or available under the external
1044
+ `REPO_ROOT` fallback used by `readAssetBytes()`.
1045
+
1046
+ ## Editing Markdown source
1047
+
1048
+ From a cloned repository, use the `edit` launcher to open a Markdown file as
1049
+ ordinary editable UTF-8 source instead of rendering it as a Markdown UI:
1050
+
1051
+ ```sh
1052
+ bun ./edit app.md
1053
+ ```
1054
+
1055
+ This is equivalent to:
1056
+
1057
+ ```sh
1058
+ bun src/index.js --edit app.md
1059
+ ```
1060
+
1061
+ Additional file and cursor arguments are forwarded unchanged.
1062
+
1063
+ ## Generated files
1064
+
1065
+ Opening a local Markdown UI generates these files beside the source file:
1066
+
1067
+ ```text
1068
+ app.md.front.js
1069
+ app.md.back.js
1070
+ app.md.html
1071
+ app.md-rpc.js
1072
+ app.md-server.js
1073
+ ```
1074
+
1075
+ They are regenerated from `app.md`, so edit the Markdown source rather than the
1076
+ generated files. The source directory must be writable.
1077
+
1078
+ From the project directory, remove generated `*.md.*` and `*.md-*` companion
1079
+ files while keeping the Markdown source files:
1080
+
1081
+ ```sh
1082
+ bun ./clean.sh
1083
+ ```
1084
+
1085
+ ## Security
1086
+
1087
+ A Markdown UI is an executable application, not a passive document. Starting a
1088
+ WUI loads its backend module, loading the page runs its frontend module, and
1089
+ activating a local terminal `javascript:` link runs frontend code. Backend and
1090
+ terminal code can read or change files, start programs, access the network, and
1091
+ read environment data with the permissions of the jsmdcui process. Only open
1092
+ or serve Markdown UI files that you trust.
1093
+
1094
+ ### WUI network exposure
1095
+
1096
+ > **Warning:** The WUI is intended for local or trusted-network use. It is not
1097
+ > a production web server.
1098
+
1099
+ - There is no login, per-user authorization, or HTTPS. Traffic and results are
1100
+ sent over plain HTTP.
1101
+ - The server may be reachable from other devices through the machine's network
1102
+ interfaces, even though the printed URL says `localhost`.
1103
+ - The random path makes the URL harder to guess, but it is not a password.
1104
+ Anyone who can reach the server and obtains the complete URL can load the
1105
+ page and call every backend function published through WUI RPC, using
1106
+ arguments they choose.
1107
+ - A backend RPC function runs with the same operating-system permissions as
1108
+ jsmdcui. Its code determines what files, commands, network services, or
1109
+ secrets a visitor may be able to reach.
1110
+ - Do not share the complete URL, forward the port to the public internet, or
1111
+ run the WUI on an untrusted network. Use a firewall when needed and stop the
1112
+ server with `Ctrl-C` as soon as you finish.
1113
+ - Prefixing a backend export with `_` keeps it out of WUI RPC discovery and
1114
+ calls, but it does not protect the backend module from trusted local code and
1115
+ is not a substitute for authentication.
1116
+
1117
+ ## Distribution - Build single-file executables
1118
+
1119
+ ### Text editor distribution
1120
+
1121
+ Distributions intended primarily as text editors can include an empty
1122
+ `src/MDCUI_DEFAULT_EDIT` file. When this marker exists, opening a `.md` file uses the
1123
+ normal editable UTF-8 view instead of automatically entering `mdcui` mode.
1124
+ Markdown UI support remains available explicitly with `--mdcui` or `--tui`;
1125
+ both are equivalent to `-encoding mdcui`.
1126
+
1127
+ ### Build-time distribution constants
1128
+
1129
+ The following switch defines are presence-based: the program checks whether
1130
+ they were passed, not whether their values are true. Consequently, `=0` and
1131
+ `=false` still enable a switch. Omit a define entirely to disable it. Examples
1132
+ use `=1` to make this explicit.
1133
+
1134
+ - `MDCUI_DEFAULT_EDIT=1`: open files as editable text by default.
1135
+ - `MDCUI_DEFAULT_DEMO=1`: add `--demo` when launched without arguments.
1136
+ - `MDCUI_DEFAULT_DEMO_WUI=1`: add `--wui` when launched without arguments.
1137
+ - `MDCUI_OVERWRITE_DEMO=1`: add `--overwrite-demo`; this modifies a selected
1138
+ demo but does not select one by itself.
1139
+ - `global.MDCUI_MAIN=<path>.md`: embed a custom Markdown application and its
1140
+ generated front, RPC, back, HTML, and server modules. When this define is
1141
+ forwarded after `--build-exe` or `--build-for`, a non-primitive value such as
1142
+ a bare path is automatically encoded as a JavaScript string. An explicitly
1143
+ quoted string remains supported.
1144
+
1145
+ For the current platform, build an executable embedding `myapp.md` with:
1146
+
1147
+ ```shell
1148
+ npx jsmdcui --build-md-exe myapp.md
1149
+ ```
1150
+
1151
+ This is a convenience alias for
1152
+ `--build-exe --define global.MDCUI_MAIN=myapp.md`.
1153
+ The generated HTML images are embedded by Bun and can be displayed by the
1154
+ compiled TUI. Add
1155
+ `--define process.env.JSMDCUI_KITTY_MODE=compat` after the Markdown path when
1156
+ the executable should enable Kitty-compatible images on a no-argument launch.
1157
+
1158
+ For cross-compilation, specify the Bun target before the Markdown file:
1159
+
1160
+ ```shell
1161
+ npx jsmdcui --build-md-for bun-linux-x64-v1.3.14 myapp.md
1162
+ ```
1163
+
1164
+ This similarly expands to
1165
+ `--build-for bun-linux-x64-v1.3.14 --define global.MDCUI_MAIN=myapp.md`. Both aliases
1166
+ are expanded before any generated application files are written.
1167
+
1168
+ Place every build define after `--build-exe`, or after the target argument of
1169
+ `--build-for`. Choose at most one of `MDCUI_DEFAULT_EDIT`,
1170
+ `MDCUI_DEFAULT_DEMO`, and `MDCUI_DEFAULT_DEMO_WUI`.
1171
+
1172
+ | Build defines | No-argument launch | Open the same app in the other UI |
1173
+ | --- | --- | --- |
1174
+ | none | normal CLI/TUI | `./mdcui --wui app.md` |
1175
+ | `MDCUI_DEFAULT_EDIT=1` | text editor | `./mdcui --tui app.md` |
1176
+ | `MDCUI_DEFAULT_DEMO=1` | `testapp.md` TUI | `./mdcui --wui --demo` |
1177
+ | `MDCUI_DEFAULT_DEMO_WUI=1` | `testapp.md` WUI | `./mdcui --tui --demo` |
1178
+ | `global.MDCUI_MAIN=../中文工具.md` | embedded custom TUI | `./mdcui --wui --demo-中文工具` |
1179
+ | MAIN plus `MDCUI_DEFAULT_DEMO_WUI=1` | embedded custom WUI | `./mdcui --tui --demo-中文工具` |
1180
+
1181
+ Any explicit runtime argument suppresses the no-argument demo/WUI injection.
1182
+ That is why the commands in the last column repeat `--demo` or
1183
+ `--demo-中文工具`; `./mdcui --wui` by itself does not implicitly select a custom
1184
+ main application.
1185
+
1186
+ To package `../中文工具.md` as a TUI by default:
1187
+
1188
+ ```sh
1189
+ bun src/index.js --build-exe \
1190
+ --define global.MDCUI_MAIN=../中文工具.md
1191
+
1192
+ ./mdcui
1193
+ ./mdcui --wui --demo-中文工具
1194
+ ```
1195
+
1196
+ To package the same application as a WUI by default and explicitly switch back
1197
+ to its TUI:
1198
+
1199
+ ```sh
1200
+ bun src/index.js --build-exe \
1201
+ --define global.MDCUI_MAIN=../中文工具.md \
1202
+ --define MDCUI_DEFAULT_DEMO_WUI=1
1203
+
1204
+ ./mdcui
1205
+ ./mdcui --tui --demo-中文工具
1206
+ ```
1207
+
1208
+ The `MDCUI_MAIN` basename must end with lowercase `.md`. Its demo-name portion
1209
+ must start with a Unicode letter or number and may contain Unicode
1210
+ letters/numbers (including Chinese), combining marks, dots, underscores, and
1211
+ hyphens. Whitespace and path separators are not allowed.
1212
+
1213
+ When the configured custom demo is selected and its local Markdown byte length
1214
+ matches the embedded copy, TUI uses the embedded front/RPC modules and WUI uses
1215
+ the embedded server. A missing demo, or one selected with
1216
+ `MDCUI_OVERWRITE_DEMO=1`, is first written from the embedded copy and then uses
1217
+ embedded modules. A different byte length prints a warning and uses filesystem
1218
+ companion modules. Directly opening `./mdcui app.md` or
1219
+ `./mdcui --wui app.md` has no demo provenance and therefore uses filesystem
1220
+ modules even if the basename matches `MDCUI_MAIN`.
1221
+
1222
+ To retain the older repository-root `testapp.md` distribution instead, build a
1223
+ TUI with:
1224
+
1225
+ ```sh
1226
+ bun src/index.js --build-exe \
1227
+ --define MDCUI_DEFAULT_DEMO=1 \
1228
+ --define MDCUI_OVERWRITE_DEMO=1
1229
+ ```
1230
+
1231
+ For a default WUI, replace `MDCUI_DEFAULT_DEMO` with
1232
+ `MDCUI_DEFAULT_DEMO_WUI`.
1233
+
1234
+ You can rename and distribute the resulting binary. It contains the Bun
1235
+ runtime, jsmdcui, the packed runtime assets, and the configured demo or custom
1236
+ main application. The target directory must remain writable because launching
1237
+ an application creates its Markdown file and generated companion files there.
1238
+
1239
+ ## Development
1240
+
1241
+ ```sh
1242
+ npm run tui
1243
+ npm run wui
1244
+ npm run check
1245
+ ```
1246
+
1247
+ `testapp.md` is the main working example.
1248
+
1249
+ testapp.md
1250
+ │
1251
+ ┌──────────────┴──────────────┐
1252
+ │ │
1253
+ ▼ ▼
1254
+ Browser HTML TUI ANSI
1255
+ │ │
1256
+ javascript:foo() extract javascript:
1257
+ │ │
1258
+ ▼ ▼
1259
+ window.frontFunc() evalFront(frontMod, text)
1260
+ │ │
1261
+ └──────────────┬──────────────┘
1262
+ ▼
1263
+ testapp.md.front.js
1264
+ │
1265
+ rpc.someFunc()
1266
+ ┌───────────┴───────────┐
1267
+ │ │
1268
+ Browser TUI
1269
+ │ │
1270
+ RPC Proxy client import * as rpc
1271
+ │ from back module
1272
+ ▼ │
1273
+ fetch rpc │
1274
+ │ │
1275
+ ▼ │
1276
+ server.mjs │
1277
+ │ │
1278
+ ▼ │
1279
+ evalBack(backMod, reqjson) │
1280
+ │ │
1281
+ └───────────┬───────────┘
1282
+ ▼
1283
+ testapp.md.back.js