@term-hub/term-hub 0.1.2 → 0.1.4

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 CHANGED
@@ -1,14 +1,32 @@
1
- <p align="center"><img src="https://raw.githubusercontent.com/AayushGour/terminal-hub/main/assets/imgs/terminal-cube.svg" alt="Terminal Hub logo" width="120"></p>
1
+ <p align="center"><img src="https://cdn.jsdelivr.net/npm/@term-hub/term-hub@latest/assets/icon.png" alt="Terminal Hub logo" width="120"></p>
2
2
 
3
- # Terminal Hub
3
+ <h1 align="center">Terminal Hub</h1>
4
4
 
5
- **Terminal mission control.** Capture every interactive shell you open (Terminal.app, iTerm, VS Code, tmux panes, …) and manage them all from one desktop app — plus spawn your own, independent of any terminal.
5
+ <p align="center"><b>Terminal mission control.</b> Capture every interactive shell you open (Terminal.app, iTerm, VS Code, tmux panes, …) and manage them all from one desktop app — plus spawn your own, independent of any terminal.</p>
6
+
7
+ <p align="center">
8
+ <img alt="macOS" src="https://img.shields.io/badge/macOS-supported-brightgreen">
9
+ <img alt="Linux" src="https://img.shields.io/badge/Linux-supported-brightgreen">
10
+ <img alt="Windows" src="https://img.shields.io/badge/Windows-in%20progress-orange">
11
+ </p>
6
12
 
7
13
  Capture is **opt-in, consent-gated, and fully reversible**. Nothing is captured until you say yes; one command reverts everything.
8
14
 
9
15
  > A terminal you kill from Terminal Hub really dies. A hub-owned session you spawn keeps running until you kill it. The background router can crash and **your shells survive** — there's no system-wide single point of failure.
10
16
 
11
- Full docs, architecture, and source: **https://github.com/AayushGour/terminal-hub**
17
+ ## Table of contents
18
+
19
+ - [Install](#install)
20
+ - [Features](#features)
21
+ - [How it works](#how-it-works)
22
+ - [Platform support](#platform-support)
23
+ - [Usage](#usage)
24
+ - [Configuration](#configuration)
25
+ - [Update](#update)
26
+ - [Uninstall](#uninstall)
27
+ - [Roadmap](#roadmap)
28
+ - [Security](#security)
29
+ - [License](#license)
12
30
 
13
31
  ## Install
14
32
 
@@ -18,33 +36,117 @@ npm i -g @term-hub/term-hub
18
36
 
19
37
  This installs the `term-hub` and `hub` commands and registers a launcher in your OS apps menu (Launchpad/Spotlight on macOS, the app grid on Linux, the Start Menu on Windows).
20
38
 
39
+ - **Launch the GUI:** run `term-hub`, or click **Terminal Hub** in your apps menu. The install registers it automatically.
40
+ - **Use the CLI:** `hub status`, `hub kill <id>`, `hub update`, `hub uninstall`, …
41
+
42
+ On **first launch**, Terminal Hub asks to enable capture — click **Enable**, then open a new terminal and it shows up.
43
+
44
+ `npm i -g @term-hub/term-hub` pulls in exactly one platform-specific binary package (`@term-hub/darwin-arm64`, `@term-hub/darwin-x64`, `@term-hub/linux-x64`, or `@term-hub/linux-arm64`) via `optionalDependencies` — npm resolves this automatically based on your OS/CPU, so you never download binaries for a platform you're not on.
45
+
46
+ ## Features
47
+
48
+ **Capture & control**
49
+ - **Auto-capture** every interactive shell via a one-time, consent-gated shell-rc hook.
50
+ - **Two views of one shell** — drive a session from hub *and* from the terminal it was spawned in.
51
+ - **Spawn hub-owned sessions** that persist independently of any terminal.
52
+ - **Session buckets** — Healthy / Ghost (dead socket) / Orphan (live, no record), so nothing gets lost.
53
+
54
+ **The canvas**
55
+ - Terminals are **floating windows** — drag the title bar to move, drag the corner to resize.
56
+ - **Infinite pannable / zoomable canvas** — drag empty space to pan, ⌘/Ctrl-scroll to zoom, **Fit** to frame them all.
57
+ - Attach / **Detach** (stop viewing, session keeps running) and **Kill** (end the shell), with in-button progress.
58
+
59
+ **Correct & safe**
60
+ - **No single point of failure** — each session owns its own pty in a detached process; killing the router never kills a shell.
61
+ - **Authenticated** — per-install token + same-uid peer-credential check on every socket.
62
+ - **Real terminal behavior** — raw-mode passthrough (arrow keys, tab-completion, Ctrl-C all work), no double-echo.
63
+ - **Reversible** — uninstall reverts the rc change, removes `~/.hub`, and removes the installed app.
64
+ - **Self-updating GUI** — the desktop app checks for, downloads, verifies (Ed25519-signed), and installs new versions of itself; no reinstall needed.
65
+
66
+ ## How it works
67
+
68
+ - **`hub-relay`** — one process per session. It **owns the pty** and a headless vt100 screen (for replay), fully detached. Because the shell lives here, the router can die and restart without touching your shells.
69
+ - **`hub-daemon`** — a non-pty **reverse-proxy router** over a single unix socket. It knows every session and fans viewers out to the right relay. It owns no pty, so it is never a single point of failure.
70
+ - **`hub-cli` (`hub`)** — install / uninstall / update / kill / status. Owns the rc-file editing (marker-guarded, byte-exact backup, edit-preserving restore) and autostart (launchd on macOS, systemd on Linux).
71
+ - **`hub-app`** — the desktop GUI: an infinite canvas of terminal windows, per-tile connection to the daemon.
72
+
73
+ ## Platform support
74
+
75
+ | Platform | Status | Notes |
76
+ |---|:---:|---|
77
+ | **macOS** (Apple Silicon & Intel) | ✅ Supported | launchd autostart, real signed `.app` bundle, self-updating |
78
+ | **Linux** (x86_64 & arm64) | ✅ Supported | systemd user unit, AppImage, self-updating |
79
+ | **Windows** | 🚧 In progress | CLI/engine work is underway; no GUI binaries published yet |
80
+
81
+ Notes:
82
+ - **macOS:** the app is ad-hoc signed (no Developer ID yet) — Gatekeeper won't complain about a locally-built or self-updated copy, but a fresh download from a browser may show an "unidentified developer" warning once.
83
+ - **Linux:** the GUI needs the webkit runtime — `sudo apt install libwebkit2gtk-4.1-0` (Debian/Ubuntu) or `sudo dnf install webkit2gtk4.1` (Fedora); the launcher tells you if it's missing.
84
+ - **Windows:** binaries aren't published yet — see [Roadmap](#roadmap).
85
+
21
86
  ## Usage
22
87
 
23
- - **Launch the GUI:** run `term-hub`, or click **Terminal Hub** in your apps menu.
24
- - **Enable capture:** on first launch, click **Enable** then open a new terminal and it shows up automatically.
25
- - **Manage from the CLI:**
88
+ - **Capture a terminal** just open a new terminal after enabling. It appears under **Healthy** as an `External` session.
89
+ - **Open a tile** click a session (or **Open**) to bring up its live terminal on the canvas.
90
+ - **Move / resize** — drag the title bar to move a window; drag the bottom-right corner to resize (the shell's size follows).
91
+ - **Pan / zoom** — drag empty canvas to pan, ⌘/Ctrl-scroll to zoom toward the cursor, **Fit** to frame all windows.
92
+ - **New hub session** — **+ New session** spawns a hub-owned shell that persists until killed.
93
+ - **Detach vs Kill** — **Detach** stops viewing (the session keeps running); **Kill** ends the shell for everyone.
94
+ - **CLI:**
26
95
  ```bash
27
96
  hub status # list live sessions (healthy / ghost / orphan)
28
97
  hub kill <id> # end a session's shell
29
- hub update # swap in a freshly built hub, in place, without dropping live sessions
30
- hub uninstall # revert everything
31
98
  ```
32
99
 
33
- ## Platform notes
100
+ ## Configuration
34
101
 
35
- - **macOS:** the launcher isn't quarantined, so there's no Gatekeeper warning and no code-signing needed.
36
- - **Linux:** the GUI needs the webkit runtime if the window doesn't open, `sudo apt install libwebkit2gtk-4.1-0` (Debian/Ubuntu) or `sudo dnf install webkit2gtk4.1` (Fedora).
37
- - **Windows:** GUI binaries are on the roadmap; not yet published.
102
+ - **Bypass capture for one shell:** `HUB_DISABLE=1` in the environment skips the hook.
103
+ - **Turn capture off globally:** uninstall (below), or comment out the marked block in your rc file.
104
+ - **Scrollback buffer:** set per-tile scrollback in the app's Settings (gear icon, bottom of the sidebar) — applies to newly opened tiles.
105
+ - **Update prompts:** the app checks for updates on launch and every 24h while open; accepting a prompt restarts the app onto the new version.
38
106
 
39
- `npm i -g @term-hub/term-hub` pulls in exactly one platform-specific binary package (`@term-hub/darwin-arm64`, `@term-hub/darwin-x64`, `@term-hub/linux-x64`, or `@term-hub/linux-arm64`) via `optionalDependencies` — npm resolves this automatically based on your OS/CPU, so you never download binaries for a platform you're not on.
107
+ ## Update
40
108
 
41
- ## Uninstall
109
+ The desktop app **self-updates** — it checks for new versions automatically and prompts you to restart when one's available. You don't need to reinstall via npm for GUI updates.
110
+
111
+ The CLI engine can also be swapped in place without dropping live sessions:
42
112
 
43
113
  ```bash
44
- hub uninstall # revert the shell-rc capture hook, stop the background daemon, delete ~/.hub
45
- npm rm -g @term-hub/term-hub # remove the CLI + apps-menu entry
114
+ hub update --bin-src <dir> [--yes]
46
115
  ```
47
116
 
117
+ - `--bin-src <dir>` — copies `hub`, `hub-daemon`, `hub-relay` from `<dir>` into `~/.hub/bin`. Omit it to leave the binaries on disk untouched and just restart the daemon.
118
+ - `--yes` — skip the confirmation prompt.
119
+
120
+ Under the hood: the daemon *process* is stopped and a fresh one started (binaries are swapped via an atomic rename). Your terminals' shells and ptys are owned by independent relay processes that are never touched — the new daemon re-discovers every still-running session on its own startup. Expect a sub-second window where `hub status` / the GUI can't reach the daemon; the sessions themselves never blink.
121
+
122
+ Requires a prior `hub install`; running it without one fails with a clear error rather than doing anything.
123
+
124
+ ## Uninstall
125
+
126
+ - **From the app:** Settings → **Uninstall hub & remove app** — reverts the rc line (preserving any edits you made after install), stops the service, deletes `~/.hub`, and removes the installed app.
127
+ - **From the CLI:**
128
+ ```bash
129
+ hub uninstall # revert the shell-rc capture hook, stop the daemon, delete ~/.hub
130
+ npm rm -g @term-hub/term-hub # remove the CLI + the installed GUI app + apps-menu entry
131
+ ```
132
+
133
+ Either path is a complete, equivalent teardown — `npm uninstall` and the in-app button both leave the exact same clean state. Uninstall is surgical: it removes **only** hub's own block from your rc file and leaves everything else untouched.
134
+
135
+ ## Roadmap
136
+
137
+ - **Windows support (in progress)** — the current engine leans on POSIX (unix sockets, `fork`/`setsid`, termios). Windows needs named-pipe transport, a `CreateProcess`-based detach, console-mode raw handling, a PowerShell-profile capture hook, Windows peer-credential auth, and Task Scheduler autostart.
138
+ - **Layouts & workspaces** — save/restore canvas arrangements; named workspaces.
139
+ - **Persistence options** — opt-in "keep external sessions alive after their terminal closes."
140
+ - **Canvas polish** — edge-resize (not just corner), snap/tiling helpers, minimap.
141
+ - **Remote sessions** — securely attach to relays on another host.
142
+
143
+ ## Security
144
+
145
+ - Every daemon/relay socket requires a per-install token (`~/.hub/token`, mode 0600) **and** a same-uid peer-credential check — a different user can't read the token or connect.
146
+ - Capture is off until you consent, and the injected rc block is guarded (`HUB_ACTIVE` / `HUB_DISABLE` / interactive / tty / `command -v hub`) so it degrades safely and never bricks your shell.
147
+ - The daemon owns no pty and never sees your shell's environment on the wire.
148
+ - The desktop app only ever installs updates whose Ed25519 signature verifies against a pinned public key — a tampered or unsigned build is rejected, both on first install and on every self-update.
149
+
48
150
  ## License
49
151
 
50
152
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@term-hub/term-hub",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Terminal Hub — capture every terminal you open and manage them all from one window. One-command cross-platform install (macOS / Linux / Windows).",
5
5
  "keywords": [
6
6
  "terminal",
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "//": "optionalDependencies: npm installs ONLY the package whose os/cpu matches the host, so a mac user downloads just the darwin binaries, etc. Versions are kept in lockstep with this package and bumped together by CI.",
41
41
  "optionalDependencies": {
42
- "@term-hub/darwin-arm64": "0.1.2",
43
- "@term-hub/darwin-x64": "0.1.2",
44
- "@term-hub/linux-x64": "0.1.2",
45
- "@term-hub/linux-arm64": "0.1.2"
42
+ "@term-hub/darwin-arm64": "0.1.4",
43
+ "@term-hub/darwin-x64": "0.1.4",
44
+ "@term-hub/linux-x64": "0.1.4",
45
+ "@term-hub/linux-arm64": "0.1.4"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=18"
@@ -29,7 +29,10 @@ const path = require("path");
29
29
  const crypto = require("crypto");
30
30
  const { execFileSync } = require("child_process");
31
31
 
32
- const REPO = "AayushGour/terminal-hub";
32
+ // Releases live in a separate public repo, not the private source repo --
33
+ // GitHub 404s release assets on a private repo for anonymous requests, which
34
+ // this postinstall download always is.
35
+ const REPO = "AayushGour/terminal-hub-releases";
33
36
  const LATEST_JSON_URL = `https://github.com/${REPO}/releases/latest/download/latest.json`;
34
37
  let PUBKEY = null;
35
38
  try {