@hyperlogue/r3 0.3.0 → 0.5.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 (2) hide show
  1. package/README.md +49 -2
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -8,6 +8,11 @@
8
8
  <a href="https://www.npmjs.com/package/@hyperlogue/r3"><img src="https://img.shields.io/npm/v/@hyperlogue/r3?color=cb3837&amp;logo=npm&amp;label=%40hyperlogue%2Fr3" alt="npm version"></a>
9
9
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license: MIT"></a>
10
10
  <img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux-lightgrey" alt="platforms: macOS, Linux">
11
+ <a href="https://hyperlogue.github.io/r3/demo/"><img src="https://img.shields.io/badge/live-demo-6164ff?logo=googlechrome&amp;logoColor=white" alt="live demo"></a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://hyperlogue.github.io/r3/demo/"><b>▶&nbsp;Try the live demo</b></a> — the full UI, running entirely in your browser.
11
16
  </p>
12
17
 
13
18
  r3 is a review tool for the diffs and docs produced by your coding agents, running
@@ -133,5 +138,47 @@ its web UI from your local device through a tunnel. Set one up however you like:
133
138
  forward (`ssh -L 8791:localhost:8791 devbox`), `tailscale serve`, or a Cloudflare
134
139
  tunnel. **Never** bind `0.0.0.0`.
135
140
 
136
- Env: `R3_PORT` (default 8791), `R3_BIND` (default `127.0.0.1`), `R3_ALLOWED_HOSTS`
137
- (comma-separated exact Host names, never `*`), `R3_PUBLIC_URL`.
141
+ **Exposing r3 beyond loopback turns on an optional login gate.** It's pure security
142
+ hardening **on by default whenever r3 is exposed** (a non-loopback bind, a
143
+ non-loopback `R3_PUBLIC_URL`, or a non-loopback `R3_ALLOWED_HOSTS`), and **off on a plain
144
+ `localhost:8791`** so the default setup needs
145
+ no login at all. Over an SSH forward you browse `localhost`, so nothing changes. When
146
+ it's on, create a token on the host and paste it into the browser once: the browser
147
+ posts that **login token** to the daemon to mint an HttpOnly session cookie, and from
148
+ then on holds only the cookie. (The login token is a scoped, revocable credential; the
149
+ daemon's own per-user API token — the CLI's credential — is never handed to a browser
150
+ when exposed.) Force it either way with `R3_REQUIRE_LOGIN=1|0`.
151
+
152
+ > **Behind your own reverse proxy, set `R3_REQUIRE_LOGIN=1`.** r3 decides whether
153
+ > to require a login from its own bind + advertised host — it can't see that
154
+ > through a proxy that rewrites the `Host` header to `127.0.0.1` (nginx's default
155
+ > `proxy_pass`), which reads as loopback-only and hands the browser the per-user
156
+ > token. Setting `R3_PUBLIC_URL` to the public name fixes it too; `tailscale serve`
157
+ > forwards the real host, so it's already covered.
158
+
159
+ ```sh
160
+ # on the host:
161
+ r3 config set publicUrl https://myhost.tailnet.ts.net # allows that Host + requires login
162
+ r3 restart # config.json is read below env
163
+ tailscale serve --bg 8791 # -> https://myhost.tailnet.ts.net/
164
+ r3 auth create-token --label laptop # prints the token once — paste it in the browser
165
+ ```
166
+
167
+ `r3 config set` **persists** these settings to `$XDG_CONFIG_HOME/r3/config.json`, so
168
+ a restart — or a daemon lazily re-spawned by any CLI call from a shell that never
169
+ exported the env vars — keeps serving remotely instead of silently dropping to
170
+ loopback-only. (`export R3_PUBLIC_URL=…` still works for a one-off run; it just
171
+ isn't remembered.) The store is a flat map — names `bind`, `port`, `publicUrl`,
172
+ `allowedHosts` (comma list), `requireLogin`: `r3 config show` dumps the JSON,
173
+ `r3 config get <name>` prints one value, `r3 config unset <name>` reverts one.
174
+
175
+ `r3 auth list-tokens` / `r3 auth revoke-token <id> | --all` manage tokens (revoking
176
+ kills its sessions immediately).
177
+
178
+ Settings: `R3_PORT` (default 8791), `R3_BIND` (default `127.0.0.1`), `R3_ALLOWED_HOSTS`
179
+ (comma-separated exact Host names, never `*`; a non-loopback name here also marks r3
180
+ exposed), `R3_PUBLIC_URL` (a non-loopback host is auto-allowed **and** marks r3
181
+ exposed, so this alone covers the common single-name `tailscale serve` case), `R3_REQUIRE_LOGIN`
182
+ (`1`/`0` to force the login requirement on or off explicitly). Each resolves
183
+ **env → `config.json` (via `r3 config set`) → default**, so env overrides the
184
+ persisted file for a single run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperlogue/r3",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Review. Revise. Resolve. — a local-first review tool for AI-generated code and docs. Runs the matching prebuilt native r3 binary (shipped as a per-platform optional dependency); works with `bunx @hyperlogue/r3` and `npx @hyperlogue/r3`.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,10 +17,10 @@
17
17
  "launch.mjs"
18
18
  ],
19
19
  "optionalDependencies": {
20
- "@hyperlogue/r3-darwin-arm64": "0.3.0",
21
- "@hyperlogue/r3-darwin-x64": "0.3.0",
22
- "@hyperlogue/r3-linux-x64": "0.3.0",
23
- "@hyperlogue/r3-linux-arm64": "0.3.0"
20
+ "@hyperlogue/r3-darwin-arm64": "0.5.0",
21
+ "@hyperlogue/r3-darwin-x64": "0.5.0",
22
+ "@hyperlogue/r3-linux-x64": "0.5.0",
23
+ "@hyperlogue/r3-linux-arm64": "0.5.0"
24
24
  },
25
25
  "engines": {
26
26
  "node": ">=18"