A terminal collaborative plain-text box: one real local user (you) and one simulated remote user ("botley") editing the same document in real time.
There is no real networking. Instead, two independent Yjs clients are kept
in sync by relaying binary updates between them with a small simulated latency —
exactly the way a real network provider would. The editor and rendering code are
completely transport-agnostic, so swapping the simulation for y-websocket /
y-webrtc later is a change confined to src/session.ts (the wiring) and
src/bot.ts (the stand-in peer).
npm install
npm startRequires Node 20+. Watch botley make bursty inserts/deletes that merge into your view in real time, each user with their own visible cursor.
| Action | Keys |
|---|---|
| Move by character | ← → ↑ ↓ |
| Move by word | ⌥← ⌥→ (Option/Alt) |
| Move by line | ⌘← ⌘→, or Ctrl+A / Ctrl+E, or Home / End |
| Jump to doc start/end | ⌘↑ ⌘↓ |
| Delete back | ⌫ char · ⌥⌫ word · ⌘⌫ line (also Ctrl+W / Ctrl+U) |
| Newline | ⏎ |
| Undo / redo | Ctrl+Z / Ctrl+Y (undoes only your own edits) |
| Quit | Ctrl+C |
Terminals don't forward the literal Cmd key, so
⌘/⌥shortcuts rely on your terminal's key bindings (e.g. iTerm2's "Natural Text Editing" preset maps⌘←/→→Ctrl+A/E,⌥←/→→ word motion,⌘⌫→Ctrl+U). TheCtrl+A/E,Ctrl+W/U, andHome/Endaliases work everywhere.
| File | Responsibility |
|---|---|
src/session.ts |
The two Y.Docs, two Awareness instances, and the update + presence relay (the architectural seam). |
src/bot.ts |
The simulated remote user. Drives remoteDoc only; reaches you via the relay. |
src/cursors.ts |
Relative-position encode/decode helpers for cursors. |
src/Editor.tsx |
The collaborative text box: renders from Yjs, handles local input. |
src/Title.tsx |
The ASCII title banner. |
src/index.tsx |
Entry point; seeds text, starts the bot, mounts the UI, cleans up. |