@term-hub/term-hub 0.1.0 → 0.1.1

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 (3) hide show
  1. package/README.md +48 -0
  2. package/bin/term-hub.js +39 -15
  3. package/package.json +12 -7
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Terminal Hub
2
+
3
+ **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.
4
+
5
+ Capture is **opt-in, consent-gated, and fully reversible**. Nothing is captured until you say yes; one command reverts everything.
6
+
7
+ > 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.
8
+
9
+ Full docs, architecture, and source: **https://github.com/AayushGour/terminal-hub**
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm i -g @term-hub/term-hub
15
+ ```
16
+
17
+ 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).
18
+
19
+ ## Usage
20
+
21
+ - **Launch the GUI:** run `term-hub`, or click **Terminal Hub** in your apps menu.
22
+ - **Enable capture:** on first launch, click **Enable** — then open a new terminal and it shows up automatically.
23
+ - **Manage from the CLI:**
24
+ ```bash
25
+ hub status # list live sessions (healthy / ghost / orphan)
26
+ hub kill <id> # end a session's shell
27
+ hub update # swap in a freshly built hub, in place, without dropping live sessions
28
+ hub uninstall # revert everything
29
+ ```
30
+
31
+ ## Platform notes
32
+
33
+ - **macOS:** the launcher isn't quarantined, so there's no Gatekeeper warning and no code-signing needed.
34
+ - **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).
35
+ - **Windows:** GUI binaries are on the roadmap; not yet published.
36
+
37
+ `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.
38
+
39
+ ## Uninstall
40
+
41
+ ```bash
42
+ hub uninstall # revert the shell-rc capture hook, stop the background daemon, delete ~/.hub
43
+ npm rm -g @term-hub/term-hub # remove the CLI + apps-menu entry
44
+ ```
45
+
46
+ ## License
47
+
48
+ MIT
package/bin/term-hub.js CHANGED
@@ -1,21 +1,38 @@
1
1
  #!/usr/bin/env node
2
- // Launch the Terminal Hub GUI. Detaches so the terminal returns immediately.
2
+ // Launch the Terminal Hub GUI (the real installed bundle -- postinstall.js
3
+ // puts it at a fixed location per platform, it is NOT shipped as a raw
4
+ // binary inside this npm package anymore, see Task 11's D1 change).
3
5
  "use strict";
4
6
 
5
7
  const { spawn } = require("child_process");
6
- const { exe } = require("../lib/resolve");
8
+ const fs = require("fs");
9
+ const os = require("os");
10
+ const path = require("path");
7
11
 
8
- let bin;
9
- try {
10
- bin = exe("hub-app");
11
- } catch (e) {
12
- console.error(String(e.message || e));
13
- process.exit(1);
12
+ function launchDarwin() {
13
+ const appPath = path.join(os.homedir(), "Applications", "Terminal Hub.app");
14
+ if (!fs.existsSync(appPath)) {
15
+ console.error(
16
+ `Terminal Hub: the app isn't installed at ${appPath}. Retry the GUI install with a fresh \`npm install -g @term-hub/term-hub\`.`
17
+ );
18
+ process.exit(1);
19
+ }
20
+ const extraArgs = process.argv.slice(2);
21
+ return spawn("open", [appPath, ...(extraArgs.length ? ["--args", ...extraArgs] : [])], {
22
+ stdio: "ignore",
23
+ detached: true,
24
+ });
14
25
  }
15
26
 
16
- // On Linux the GUI needs the webkit2gtk runtime; hint if it's obviously missing.
17
- if (process.platform === "linux") {
18
- const fs = require("fs");
27
+ function launchLinux() {
28
+ const appImagePath = path.join(os.homedir(), ".local", "share", "term-hub", "hub-app.AppImage");
29
+ if (!fs.existsSync(appImagePath)) {
30
+ console.error(
31
+ `Terminal Hub: the app isn't installed at ${appImagePath}. Retry the GUI install with a fresh \`npm install -g @term-hub/term-hub\`.`
32
+ );
33
+ process.exit(1);
34
+ }
35
+ // Same webkit2gtk hint as before -- the AppImage needs it at runtime.
19
36
  const hasWebkit = ["/usr/lib", "/usr/lib/x86_64-linux-gnu", "/usr/lib/aarch64-linux-gnu", "/usr/lib64"].some(
20
37
  (d) => {
21
38
  try {
@@ -32,12 +49,19 @@ if (process.platform === "linux") {
32
49
  " Fedora: sudo dnf install webkit2gtk4.1"
33
50
  );
34
51
  }
52
+ return spawn(appImagePath, process.argv.slice(2), { stdio: "ignore", detached: true });
53
+ }
54
+
55
+ let child;
56
+ if (process.platform === "darwin") {
57
+ child = launchDarwin();
58
+ } else if (process.platform === "linux") {
59
+ child = launchLinux();
60
+ } else {
61
+ console.error("Terminal Hub: the GUI isn't available on this platform yet.");
62
+ process.exit(1);
35
63
  }
36
64
 
37
- const child = spawn(bin, process.argv.slice(2), {
38
- stdio: "ignore",
39
- detached: true,
40
- });
41
65
  child.on("error", (err) => {
42
66
  console.error(`Terminal Hub: failed to launch (${err.message}).`);
43
67
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@term-hub/term-hub",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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",
@@ -11,9 +11,14 @@
11
11
  "terminal-manager",
12
12
  "tauri"
13
13
  ],
14
- "homepage": "https://github.com/your-org/term-hub#readme",
14
+ "homepage": "https://github.com/AayushGour/terminal-hub#readme",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/AayushGour/terminal-hub.git",
18
+ "directory": "hub/npm/term-hub"
19
+ },
15
20
  "license": "MIT",
16
- "author": "TODO your name <ag14906@gmail.com>",
21
+ "author": "Aayush Gour <ag14906@gmail.com>",
17
22
  "type": "commonjs",
18
23
  "bin": {
19
24
  "term-hub": "bin/term-hub.js",
@@ -31,10 +36,10 @@
31
36
  },
32
37
  "//": "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.",
33
38
  "optionalDependencies": {
34
- "@term-hub/darwin-arm64": "0.1.0",
35
- "@term-hub/darwin-x64": "0.1.0",
36
- "@term-hub/linux-x64": "0.1.0",
37
- "@term-hub/linux-arm64": "0.1.0"
39
+ "@term-hub/darwin-arm64": "0.1.1",
40
+ "@term-hub/darwin-x64": "0.1.1",
41
+ "@term-hub/linux-x64": "0.1.1",
42
+ "@term-hub/linux-arm64": "0.1.1"
38
43
  },
39
44
  "engines": {
40
45
  "node": ">=18"