@remotego/remotego 1.0.1 → 1.1.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.
package/README.md CHANGED
@@ -5,7 +5,7 @@ Expose any CLI tool as a public web terminal via tunnel.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install -g @zhanju/remotego
8
+ npm install -g @remotego/remotego
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -20,6 +20,7 @@ remotego <command> [command-args...] [options]
20
20
  |--------|-------------|---------|
21
21
  | `--port <port>` | Port to listen on | `7681` |
22
22
  | `--cwd <dir>` | Working directory for the command | Current directory |
23
+ | `--domain <domain>` | Custom domain for localhost.run tunnel | Random subdomain |
23
24
  | `--help, -h` | Show help | |
24
25
 
25
26
  ### Examples
@@ -40,6 +41,9 @@ remotego vim
40
41
  # Custom port
41
42
  remotego --port 9000 node
42
43
 
44
+ # Custom tunnel domain
45
+ remotego --domain myterm.localhost.run bash
46
+
43
47
  # Pass flags to the command (use -- to separate)
44
48
  remotego -- git log --oneline
45
49
  ```
package/bin/remotego.js CHANGED
@@ -29,6 +29,8 @@ function parseArgs(argv) {
29
29
  flags.port = argv[++i];
30
30
  } else if (arg === '--cwd' && argv[i + 1]) {
31
31
  flags.cwd = argv[++i];
32
+ } else if (arg === '--domain' && argv[i + 1]) {
33
+ flags.domain = argv[++i];
32
34
  } else if (arg === '--help' || arg === '-h') {
33
35
  printHelp();
34
36
  process.exit(0);
@@ -62,17 +64,19 @@ Usage:
62
64
  remotego claude
63
65
 
64
66
  Options:
65
- --port <port> Port to listen on (default: 7681)
66
- --cwd <dir> Working directory for the command (default: current dir)
67
- --help, -h Show this help message
67
+ --port <port> Port to listen on (default: 7681)
68
+ --cwd <dir> Working directory for the command (default: current dir)
69
+ --domain <domain> Custom domain for localhost.run tunnel (default: random)
70
+ --help, -h Show this help message
68
71
 
69
72
  Examples:
70
- remotego claude # Mirror Claude Code
71
- remotego vim # Mirror vim editor
72
- remotego bash # Mirror a bash shell
73
- remotego python3 -i # Mirror Python REPL
74
- remotego --port 9000 node # Mirror Node.js REPL on port 9000
75
- remotego -- --flagged-arg # Use -- to separate flags from command args
73
+ remotego claude # Mirror Claude Code
74
+ remotego vim # Mirror vim editor
75
+ remotego bash # Mirror a bash shell
76
+ remotego python3 -i # Mirror Python REPL
77
+ remotego --port 9000 node # Mirror Node.js REPL on port 9000
78
+ remotego --domain myterm.localhost.run bash # Custom tunnel domain
79
+ remotego -- --flagged-arg # Use -- to separate flags from command args
76
80
  `);
77
81
  }
78
82
 
@@ -98,6 +102,10 @@ if (flags.port) {
98
102
  env.PORT = flags.port;
99
103
  }
100
104
 
105
+ if (flags.domain) {
106
+ env.TUNNEL_DOMAIN = flags.domain;
107
+ }
108
+
101
109
  // Install server dependencies if needed
102
110
  import { existsSync } from 'fs';
103
111
  if (!existsSync(resolve(serverDir, 'node_modules'))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotego/remotego",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Expose any CLI tool as a public web terminal via tunnel",
5
5
  "bin": {
6
6
  "remotego": "bin/remotego.js"
@@ -1,11 +1,21 @@
1
1
  #!/bin/bash
2
2
 
3
3
  # remoting.sh - Mirror a CLI tool in a browser (Claude plugin default: claude)
4
- # Usage: remoting.sh [port]
4
+ # Usage: remoting.sh [port] [--domain <domain>]
5
5
 
6
6
  set -euo pipefail
7
7
 
8
- PORT="${1:-7681}"
8
+ PORT="7681"
9
+ DOMAIN=""
10
+
11
+ while [[ $# -gt 0 ]]; do
12
+ case "$1" in
13
+ --domain)
14
+ DOMAIN="$2"; shift 2 ;;
15
+ *)
16
+ PORT="$1"; shift ;;
17
+ esac
18
+ done
9
19
 
10
20
  # Check Node.js
11
21
  if ! command -v node &>/dev/null; then
@@ -27,4 +37,11 @@ fi
27
37
  # Save caller's cwd so the command starts in the right directory
28
38
  REMOTE_CWD="$(pwd)"
29
39
  cd "$SERVER_DIR"
30
- exec env PORT="$PORT" REMOTE_CMD="claude" REMOTE_ARGS="[]" REMOTE_CWD="$REMOTE_CWD" node server.js
40
+
41
+ # Build tunnel domain env var if specified
42
+ TUNNEL_ENV=""
43
+ if [ -n "$DOMAIN" ]; then
44
+ TUNNEL_ENV="TUNNEL_DOMAIN=$DOMAIN"
45
+ fi
46
+
47
+ exec env PORT="$PORT" REMOTE_CMD="claude" REMOTE_ARGS="[]" REMOTE_CWD="$REMOTE_CWD" $TUNNEL_ENV node server.js
package/server/server.js CHANGED
@@ -12,6 +12,7 @@ const __dirname = dirname(__filename);
12
12
 
13
13
  const PORT = process.env.PORT || 7681;
14
14
  const SESSION_ID = randomUUID();
15
+ const TUNNEL_DOMAIN = process.env.TUNNEL_DOMAIN || '';
15
16
  const clients = new Set();
16
17
 
17
18
  // Command to run in PTY — configurable via env vars
@@ -204,9 +205,14 @@ server.listen(PORT, () => {
204
205
  });
205
206
 
206
207
  function startTunnel(localUrl) {
208
+ // Build SSH -R argument: custom domain or random subdomain
209
+ const remoteArg = TUNNEL_DOMAIN
210
+ ? `${TUNNEL_DOMAIN}:80:localhost:${PORT}`
211
+ : `80:localhost:${PORT}`;
212
+
207
213
  const tunnel = spawn('ssh', [
208
214
  '-o', 'StrictHostKeyChecking=no',
209
- '-R', `80:localhost:${PORT}`,
215
+ '-R', remoteArg,
210
216
  'nokey@localhost.run',
211
217
  ], {
212
218
  name: 'xterm-256color',