OverviewFilesCommitsIssuesDocsReleasesPeers

mirall-cli commits / 526d611

docs: document the --web local UI (README + CLI usage)
The web-UI (mirall daemon --web PORT) was undocumented despite being enabled by default under pgh (pgh.defaults.args = daemon --web 4188). Add a README Web-UI section + layout/install notes, and add --web to the CLI usage string and header comment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
526d611f415e66cab66dd4029a651a3845f0bea9
by plankatron <fleeky@gmail.com> · 2026-07-24T14:58:59.000Z

Changed files (2) +33 -3

README.md +28 -0
……@@ -44,6 +44,8 @@ A single always-on peer:
4444 them), verified and resumable — the same engine Mirall uses
4545- discoverable **by [hyperident](https://github.com/holepunchto) identity** — reach a peer by
4646 a stable pubkey/petname (`dial --name`) instead of pasting a 256-bit invite
47- optionally drives **Mirall's real React UI in a local browser** (`--web PORT`) — the same
48 renderer the desktop app uses, served on `127.0.0.1` only (see [Web-UI](#web-ui-optional))
4749
4850## Install (via pgh)
4951
……@@ -52,6 +54,10 @@ pgh app install mirall # (once published to the registry)
5254pgh app start mirall # boots the daemon under the pgh supervisor
5355```
5456
57The pgh-managed daemon starts with `daemon --web 4188` by default (`pgh.defaults.args` in
58`package.json`), so once it's up the browser UI is at **http://127.0.0.1:4188** — no extra
59step. See [Web-UI](#web-ui-optional).
60
5561Or adopt a working tree directly:
5662
5763```sh
……@@ -77,6 +83,27 @@ mirall dial --name alice # fetch its invite + join
7783mirall mirror --space <id> --owner <key> --share <id> --path /srv/mirror
7884```
7985
86## Web-UI (optional)
87
88The daemon can serve **Mirall's real React UI** in a local browser — the same renderer the
89desktop app ships, driving the same vendored engine. It is **not** a reimplementation; the
90bundle under `web/dist/` is Mirall's, and `web/bridge-shim.js` recreates the `window.bridge`
91API the renderer expects (standing in for Electron's preload bridge).
92
93```sh
94mirall daemon --web 4188 # serve the UI on http://127.0.0.1:4188
95```
96
97- **Localhost only.** The server binds `127.0.0.1` exclusively — the daemon holds the
98 identity, so the UI is never exposed on the network. There is no auth beyond that.
99- **How it bridges to the engine:** the browser talks to the Bare worker over HTTP —
100 Server-Sent Events on `/worker/events` (worker → browser, base64 NDJSON frames) and
101 `POST /worker/write` (browser → worker). A local folder-picker (`/fs/list`) lets you
102 choose directories to share from the browser (it lists *your own* filesystem only).
103- **On by default under pgh.** `pgh.defaults.args` is `["daemon", "--web", "4188"]`, so a
104 pgh-installed node comes up with the UI at http://127.0.0.1:4188. Run the daemon without
105 `--web` for a headless, CLI-only node.
106
80107## Layout
81108
82109| Path | What |
……@@ -85,6 +112,7 @@ mirall mirror --space <id> --owner <key> --share <id> --path /srv/mirror
85112| `bin/mirall.js` | the CLI + daemon (our headless host) |
86113| `cli/host.js` | spawns the worker via `bare-sidecar` + drives its NDJSON IPC |
87114| `cli/e2e-mirror.js`, `cli/capstone-*.js` | two-node / cross-machine test harnesses |
115| `web/` | **Mirall's React bundle** (`dist/`) + `bridge-shim.js` — served by `--web` (see [Web-UI](#web-ui-optional)) |
88116| `node_modules/` | **committed** — see below |
89117
90118## ⚠️ Dependencies are vendored — do not `npm install`
bin/mirall.js +5 -3
……@@ -1,6 +1,7 @@
11// mirall — headless CLI for the Mirall P2P engine (pgh-app shape, no Electron).
2// bare bin/mirall.js daemon [--storage DIR] [--downloads DIR] [--sock PATH]
2// bare bin/mirall.js daemon [--storage DIR] [--downloads DIR] [--sock PATH] [--web PORT]
33// bare bin/mirall.js <command> [--flags] (talks to a running daemon over hyper-svc UDS)
4// --web PORT also serves Mirall's real React UI on 127.0.0.1:PORT (localhost only).
45//
56// The daemon boots one worker (via cli/host.js) and exposes a hyper-svc UDS Service that
67// proxies commands to the worker; each client invocation connects to that UDS, calls, prints.
……@@ -49,7 +50,7 @@ const TABLE = {
4950
5051const USAGE = `mirall — headless P2P file transfer CLI
5152
52 mirall daemon [--storage DIR] [--downloads DIR] [--sock PATH]
53 mirall daemon [--storage DIR] [--downloads DIR] [--sock PATH] [--web PORT]
5354 mirall status
5455 mirall whoami print this node's hyperident pubkey (dial address)
5556 mirall contact add NAME PUBKEY | contact list local petname → hyperident-pubkey map (for --name)
……@@ -64,7 +65,8 @@ const USAGE = `mirall — headless P2P file transfer CLI
6465 mirall mirror --space ID --owner KEY --share ID --path DIR
6566 mirall files list --space ID
6667
67 --sock PATH daemon control socket (default ${DEFAULT_SOCK})`
68 --sock PATH daemon control socket (default ${DEFAULT_SOCK})
69 --web PORT (daemon) serve Mirall's React UI on http://127.0.0.1:PORT (localhost only)`
6870
6971const HYPERIDENT_PUB = path.join(HOME, '.hyperident', 'identity.pub')
7072const CONTACTS = path.join(HOME, '.mirall', 'contacts.json')