accelr8 1.0.0 → 2.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/README.md +118 -0
- package/dist/chunks/chunk-BVRGM7YI.js +24 -0
- package/dist/chunks/client-FMFGODEU.js +593 -0
- package/dist/chunks/server-CG3UEKLP.js +270 -0
- package/dist/cli.js +77 -0
- package/package.json +47 -12
- package/worker/src/worker.ts +293 -0
- package/worker/wrangler.jsonc +10 -0
- package/ascii.txt +0 -11
- package/bin/index.js +0 -314
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# accelr8
|
|
2
|
+
|
|
3
|
+
Collaborative ascii canvas in your terminal. A real CLI app: mouse-driven TUI,
|
|
4
|
+
real multiplayer, and live cursors that glide as your friends move them.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
('-. ('-. _ .-')
|
|
8
|
+
( OO ).-. _( OO) ( \( -O )
|
|
9
|
+
/ . --. / .-----. .-----. (,------. ,--. ,------. .-----.
|
|
10
|
+
| \-. \ ' .--./ ' .--./ | .---' | |.-') | /`. ' / .-. \
|
|
11
|
+
.-'-' | | | |('-. | |('-. | | | | OO ) | / | | | \_.' /
|
|
12
|
+
\| |_.' | /_) |OO ) /_) |OO ) (| '--. | |`-' | | |_.' | / .-. '.
|
|
13
|
+
| .-. | || |`-'| || |`-'| | .--' (| '---.' | . '.' | | | |
|
|
14
|
+
| | | | (_' '--'\ (_' '--'\ | `---. | | | |\ \ \ '-' /
|
|
15
|
+
`--' `--' `-----' `-----' `------' `------' `--' '--' `----''
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g accelr8
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Use
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
accelr8 # open the app
|
|
28
|
+
accelr8 join XYMRAU # jump straight into a friend's project
|
|
29
|
+
accelr8 --name pat # pick your display name (remembered)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Create a project in the **Projects** tab, paint on the **Canvas** by clicking
|
|
33
|
+
and dragging (right-click erases), and grab the join code from the **Members**
|
|
34
|
+
tab. Everyone in a project sees everyone else's cursor move live.
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
accelr8 collaborative ascii canvas you ●
|
|
38
|
+
Projects Canvas Members ● live
|
|
39
|
+
────────────────────────────────────────────────────────────────────────
|
|
40
|
+
brush █ ▓ ▒ ░ ● ◆ ★ ▲ ■ · # @ * ⌫ erase clear
|
|
41
|
+
┌─ canvas 100×30 ───────────────────────────────────────────────────────┐
|
|
42
|
+
│ █ │
|
|
43
|
+
│ █ ▲ alice │
|
|
44
|
+
│ █ │
|
|
45
|
+
│ ▲ bob │
|
|
46
|
+
└────────────────────────────────────────────────────────────────────────┘
|
|
47
|
+
landing page redesign · code XYMRAU · 3 online [tab] switch [q] quit
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Controls
|
|
51
|
+
|
|
52
|
+
| Input | Action |
|
|
53
|
+
|---|---|
|
|
54
|
+
| Mouse click | tabs, buttons, project rows, palette |
|
|
55
|
+
| Click + drag on canvas | paint with the current brush |
|
|
56
|
+
| Right-click on canvas | erase a cell |
|
|
57
|
+
| `Tab` / `1` `2` `3` | switch tabs |
|
|
58
|
+
| `q` / `Ctrl-C` | quit |
|
|
59
|
+
|
|
60
|
+
## How the live cursors work
|
|
61
|
+
|
|
62
|
+
The terminal reports mouse motion via ANSI escape sequences (any-event
|
|
63
|
+
tracking, `ESC[?1003h`). The app:
|
|
64
|
+
|
|
65
|
+
1. **Throttles** outgoing cursor positions to ~25/sec.
|
|
66
|
+
2. **Interpolates** on the receiving side: each remote cursor lerps toward its
|
|
67
|
+
last reported position every frame (`x += (target - x) * 0.35`), so it
|
|
68
|
+
glides smoothly instead of teleporting between throttled updates.
|
|
69
|
+
|
|
70
|
+
Sparse sends plus client-side smoothing is what makes it feel live.
|
|
71
|
+
|
|
72
|
+
## Sync server
|
|
73
|
+
|
|
74
|
+
By default the CLI talks to the hosted sync server (a Cloudflare Worker with a
|
|
75
|
+
Durable Object, source in `worker/`). You can point it anywhere:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
accelr8 --server ws://localhost:8787 # or export ACCELR8_SERVER=...
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Self-hosting
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
accelr8 serve # starts a sync server on :8787
|
|
85
|
+
accelr8 serve --port 9000 # custom port
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Expose it beyond your machine with a quick tunnel:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cloudflared tunnel --url http://localhost:8787
|
|
92
|
+
# friends then run: accelr8 --server wss://something.trycloudflare.com
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Deploy your own copy of the hosted worker:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
cd worker && npx wrangler deploy
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm install
|
|
105
|
+
npm run dev # run the TUI from source
|
|
106
|
+
npm run serve # run the sync server from source
|
|
107
|
+
npm run smoketest # headless two-client sync test (needs a server)
|
|
108
|
+
npm run rendertest # headless frame dumps of every screen
|
|
109
|
+
npm run build # bundle dist/cli.js
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Layout:
|
|
113
|
+
|
|
114
|
+
- `src/protocol.ts` shared wire types + constants (fixed 100×30 logical canvas)
|
|
115
|
+
- `src/cli.ts` entry point, arg parsing
|
|
116
|
+
- `src/client.ts` the TUI: mouse/keyboard, flicker-free rendering, cursor lerp
|
|
117
|
+
- `src/server.ts` self-host sync server (Node, `ws`)
|
|
118
|
+
- `worker/` hosted sync server (Cloudflare Worker + Durable Object)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/protocol.ts
|
|
4
|
+
var VERSION = "2.0.0";
|
|
5
|
+
var PORT = 8787;
|
|
6
|
+
var DEFAULT_SERVER = "wss://accelr8-canvas.patonchain.workers.dev";
|
|
7
|
+
var CANVAS_W = 100;
|
|
8
|
+
var CANVAS_H = 30;
|
|
9
|
+
function encode(msg) {
|
|
10
|
+
return JSON.stringify(msg);
|
|
11
|
+
}
|
|
12
|
+
function decode(data) {
|
|
13
|
+
return JSON.parse(data);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
VERSION,
|
|
18
|
+
PORT,
|
|
19
|
+
DEFAULT_SERVER,
|
|
20
|
+
CANVAS_W,
|
|
21
|
+
CANVAS_H,
|
|
22
|
+
encode,
|
|
23
|
+
decode
|
|
24
|
+
};
|