bunmicro 0.9.25 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0] - 2026-06-22
4
+ - Changed command -v to Bun.which
5
+ * for performance improvement
6
+ - Added experimental CDP support
7
+ * Chrome DevTools Protocol server (Ctrl+E cdp [port])
8
+ * Allows automation via Playwright or Bun.WebView
9
+ * --remote-debugging-port=PORT flag to auto-start at launch
10
+ - Fixed Escape action now routes through full input pipeline
11
+ * Correctly handles terminal pane, TTS, and mark selection
12
+
13
+ ## [0.9.30] - 2026-06-13
14
+ - Fixed binary edit hex3 regression
15
+ * see readme
16
+ - Added crash backup recovery
17
+
3
18
  ## [0.9.25] - 2026-06-10
4
19
  - Fixed colorscheme: aligned with go
5
20
  - Added colorcolumn taberror showchars
package/README.md CHANGED
@@ -35,6 +35,16 @@
35
35
  - Works like bat ccat glow
36
36
  - bunmicro -bat file
37
37
  - aliases: --cat --bat --ccat --glow
38
+ ## Binary edit by hex3
39
+ - Edit binary files like text files
40
+ - bunmicro libc.so.6
41
+ - Ctrl+E reopen hex3
42
+ - Printable chars stay readable
43
+ * a => a..
44
+ - Non-printable chars become escapes
45
+ * \xff => \ff
46
+ - Search & Edit by plain text
47
+ - And simply save by Ctrl+S
38
48
  ## Preview color schemes(theme)
39
49
  - Ctrl-E theme, then press Tab and use arrow keys to preview
40
50
  ## Mouse clicks more useful
@@ -51,6 +61,19 @@
51
61
  - No native bindings
52
62
  - No recompilation
53
63
  - Just Copy folder -> Run with Bun
64
+ ## CDP — Chrome DevTools Protocol (experimental)
65
+ - Control bunmicro like a browser from an external script
66
+ - Start from command prompt: `Ctrl-E cdp` (default port 9222) or `Ctrl-E cdp 9000`
67
+ - Or launch with: `bunmicro --remote-debugging-port=9222 file.txt`
68
+ - Once running, connect with Bun.WebView or Playwright:
69
+ ```js
70
+ const view = new Bun.WebView({ backend: { type: "chrome", url: "ws://127.0.0.1:9222" } });
71
+ await view.navigate("file.txt");
72
+ await view.type("hello");
73
+ await view.press("Enter");
74
+ ```
75
+ - Supports: navigate, type, press, click(x,y), scroll(dx,dy), scrollTo, evaluate, goBack, goForward
76
+ - Full client example: `Ctrl-E help cdp`
54
77
  ## Version shows backends
55
78
  - bunmicro --version shows http/clipboard/tts backends
56
79
 
package/hlw.md CHANGED
@@ -1,3 +1,4 @@
1
+ # bunmicro
1
2
  # hello
2
3
  - world
3
4
  - 你好 世界 😅
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunmicro",
3
- "version": "0.9.25",
3
+ "version": "1.0.0",
4
4
  "description": "Bun JavaScript rewrite of the micro editor originally in Golang",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env bun
2
+
3
+ // ─── CDP (Chrome DevTools Protocol) ────────────────────────────────────────
4
+ //
5
+ // bunmicro can act as a CDP target, letting external scripts control it
6
+ // the same way Playwright or Bun.WebView controls a browser.
7
+ //
8
+ // ── Starting the server ────────────────────────────────────────────────────
9
+ //
10
+ // Inside the editor:
11
+ // Ctrl-E cdp → 127.0.0.1:9222
12
+ // Ctrl-E cdp 9000 → 127.0.0.1:9000
13
+ // Ctrl-E cdp --public → 0.0.0.0:9222
14
+ // Ctrl-E cdp 9000 --public → 0.0.0.0:9000
15
+ // Ctrl-E cdp --address=192.168.1.1 → 192.168.1.1:9222
16
+ // Ctrl-E cdp 9000 --address=192.168.1.1 → 192.168.1.1:9000
17
+ //
18
+ // From the command line (Chrome-style):
19
+ // bunmicro --remote-debugging-port=9222 file.txt
20
+ // bunmicro --remote-debugging-port=9222 --remote-debugging-address=0.0.0.0 file.txt
21
+ //
22
+ // Once running, status bar shows: CDP@<port> server running
23
+ // Running cdp again shows: CDP@<port> already running
24
+ //
25
+ // ── Connecting ─────────────────────────────────────────────────────────────
26
+ //
27
+ // Bun.WebView:
28
+ // const view = new Bun.WebView({
29
+ // backend: { type: "chrome", url: "ws://127.0.0.1:9222" }
30
+ // });
31
+ //
32
+ // Playwright (Node/Bun):
33
+ // const browser = await chromium.connectOverCDP("http://127.0.0.1:9222");
34
+ //
35
+ // ── Available methods ───────────────────────────────────────────────────────
36
+ //
37
+ // view.navigate(url) open file or URL in editor (Ctrl-E open)
38
+ // view.type(text) insert text at cursor
39
+ // view.press(key, opts?) send a key press
40
+ // key: "Enter","Backspace","Tab","Escape",
41
+ // "ArrowUp/Down/Left/Right",
42
+ // "Home","End","PageUp","PageDown",
43
+ // or single char "a"
44
+ // opts: { modifiers: bitmask }
45
+ // Alt=1 Ctrl=2 Meta=4 Shift=8
46
+ // view.click(x, y) move cursor to column x, line y (1-based)
47
+ // view.scroll(dx, dy) move cursor by dx cols and dy lines
48
+ // view.scrollTo(selector) find text or #anchor and jump to it
49
+ // view.evaluate(jsCode) run JS inside bunmicro's plugin context
50
+ // e.g. "micro.cmd.save()"
51
+ // view.goBack() switch to previous tab (PrevTab)
52
+ // view.goForward() switch to next tab (NextTab)
53
+ // view.resize(w, h) accepted by protocol but not yet implemented
54
+ //
55
+ // ── Example script below ───────────────────────────────────────────────────
56
+ // ctrl-a ctrl-c = select+copy all
57
+ // ctrl-t = new tab
58
+ // ctrl-v = paste
59
+ // ctrl-s filename.js enter
60
+ // run with bun filename.js
61
+
62
+ const cdpUrl = "ws://127.0.0.1:9222";
63
+
64
+ const view = new Bun.WebView({
65
+ backend: {
66
+ type: "chrome",
67
+ url: cdpUrl,
68
+ },
69
+ });
70
+
71
+ view.onNavigated = (url, title) => {
72
+ console.log(`[navigated] ${title || "(no title)"} — ${url.slice(0, 80)}`);
73
+ };
74
+
75
+ const delay = Bun.sleep
76
+ const startInterval = 1000
77
+ const interval = 500
78
+
79
+ try {
80
+
81
+ await delay(startInterval);
82
+
83
+ await view.navigate("https://raw.githubusercontent.com/jjtseng93/bunmicro/refs/heads/main/hlw.md");
84
+ await delay(interval);
85
+
86
+ await view.evaluate(
87
+ "micro.cmd.tab()"
88
+ );
89
+ await delay(interval);
90
+
91
+ await view.goBack();
92
+ await delay(interval);
93
+
94
+ //await view.goForward();
95
+ //await delay(interval);
96
+
97
+ await view.scrollTo("#hello");
98
+ await view.evaluate('micro.action.StartOfLine()');
99
+ await delay(interval);
100
+
101
+ await view.type("# Bun is great");
102
+ await delay(interval);
103
+
104
+ await view.press("Enter");
105
+ await delay(interval);
106
+
107
+ await view.click(3,3);
108
+ await delay(interval);
109
+ await view.scroll(4,3);
110
+
111
+ await view.resize(1280, 720);
112
+ await delay(interval);
113
+
114
+ console.log(
115
+ Bun.markdown.ansi('### All done')
116
+ )
117
+ } finally {
118
+ view.close();
119
+ }