@hahahhh/sshx 0.0.3 → 0.0.4-rc.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 +25 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  **sshx** is a drop-in wrapper around OpenSSH. Wrap it as `alias ssh=sshx` and your existing SSH workflow works exactly as before — every flag, config, and connection passes through verbatim. But when you connect to a host (or Docker container) with sshx-aware features enabled, you unlock a persistent, shared remote server that gives you:
6
6
 
7
7
  - 🔄 **Reverse command bridge** — run `sshx local <cmd>` *on the remote* to execute commands on your local machine, with stdout, stderr, exit code, and stdin all propagated.
8
+ - 📁 **Bidirectional workspace mount** — opt in to make the command initiator's current directory available to commands running on the other side.
8
9
  - 🔌 **Automatic port forwarding** — remote local listeners (loopback `127.0.0.1` and wildcard `0.0.0.0`; e.g., a dev server on `0.0.0.0:8080` or `localhost:8080`) are automatically detected and forwarded to your local machine.
9
10
  - 🌐 **Local domain binding** — access forwarded ports as `<host>.<your-user>.sshx:<port>` in your local browser, no manual `-L` flags needed.
10
11
  - 🐳 **Docker container support** — target running containers by name or ID: `sshx my-container`. Command bridge support works inside containers via `docker exec`.
@@ -59,6 +60,19 @@ sshx local --timeout=30 npm test
59
60
  - Commands have no implicit deadline. Put `--timeout=<duration>` immediately after the target to opt in; bare numbers mean seconds, and values such as `500ms`, `30s`, and `2m` are accepted. Timed-out commands exit with status 124.
60
61
  - Policy: a configurable deny list controls which commands are blocked.
61
62
 
63
+ ### 📁 Bidirectional Workspace Mount (opt-in, beta)
64
+
65
+ Set `features.remoteFs: true` to expose the command initiator's current directory through a read-write FUSE mount:
66
+
67
+ - `sshx remote <cmd>` starts the remote command in a mounted view of the local current directory.
68
+ - An interactive `sshx remote` shell still starts in the remote home. `SSHX_WORKSPACE` points to the mounted local workspace.
69
+ - From that shell, `sshx local <cmd>` mounts the remote current directory locally and starts the local command there.
70
+ - Writes and `fsync` are sent to the source immediately. Metadata and directory entries use short TTLs and are revalidated when files are reopened.
71
+
72
+ FUSE is a hard dependency when this feature is enabled: a mount failure aborts the command even when `strict` is false. Linux needs `/dev/fuse` plus `fusermount`/`fusermount3`; macOS needs a current macFUSE installation and is currently beta. The remote target must be Linux with FUSE available.
73
+
74
+ The first version guarantees workspace-relative paths only. It does not rewrite absolute command arguments, add extra mount roots, expose special files/xattrs/ACLs, or support Docker targets, FUSE-T, or FSKit. It is optimized for source trees and small files rather than large-file throughput.
75
+
62
76
  ### 🔌 Automatic Port Detection & Forwarding
63
77
 
64
78
  When a process on the remote starts listening on `127.0.0.1` or `0.0.0.0` (e.g., `npm run dev` on port 3000), sshx detects it and:
@@ -217,6 +231,10 @@ features:
217
231
  # <host>.<user>.sshx:<remote-port>.
218
232
  autoForward: true
219
233
 
234
+ # Read-write workspace mounts in both command directions. Default: false.
235
+ # Requires FUSE on the local machine and remote target.
236
+ remoteFs: false
237
+
220
238
  commands:
221
239
  # Commands blocked from bridge execution.
222
240
  deny: []
@@ -241,7 +259,7 @@ commands:
241
259
  ```
242
260
 
243
261
  1. **Connection**: `sshx remote` opens a normal SSH session and starts (or connects to) the client-target `sshx server` under `~/.sshx_server/<uuid>`.
244
- 2. **Bridge channel**: A hidden `socket-proxy` SSH channel links the local daemon to the remote server.
262
+ 2. **Bridge channels**: A hidden control `socket-proxy` channel links the client to the remote server. `remoteFs` adds a separately framed, bounded data channel paired by session ID.
245
263
  3. **Port sniffing**: The server reads `/proc/net/tcp*` (Linux) to detect loopback (`127.0.0.1` / `::1`) and wildcard (`0.0.0.0` / `::`) listeners.
246
264
  4. **Forwarding**: Detected ports are forwarded through a single shared local daemon using `ssh -W`.
247
265
  5. **Domains**: The local DNS responder maps `<target>.<suffix>` → localhost. The browser's URL port selects the local forwarded port.
@@ -255,6 +273,8 @@ When `sshx` is invoked for a **non-matching host** (no sshx config, or host not
255
273
  - `sshx --no-wrap ...` — skip all sshx behavior and call raw `ssh`.
256
274
  - `SSHX_DISABLE=1 sshx ...` — same as `--no-wrap`, useful in scripts.
257
275
  - `sshx local ...` on a **client** (not inside a remote session) — errors immediately with a clear message. `local` is globally reserved.
276
+ - `remoteFs` never silently falls back to an unmounted command. A failed FUSE mount fails the invocation.
277
+ - Workspace exports are anchored with Go's `os.Root`; path traversal and symlink escapes are rejected.
258
278
  - Docker containers that aren't running or can't be reached are pure passthrough — sshx falls back to raw `ssh` with no side effects.
259
279
  - Unmatched hosts are pure passthrough — no files created, no processes started.
260
280
 
@@ -271,6 +291,7 @@ When `sshx` is invoked for a **non-matching host** (no sshx config, or host not
271
291
  - **Client**: macOS and Linux are fully supported.
272
292
  - **Server**: Linux is required for the remote sshx server (uses `/proc/net/tcp*` for port detection).
273
293
  - **Docker Client**: macOS and Linux — targets any running Docker container via `docker exec`.
294
+ - **remoteFs**: Linux is supported; macOS clients require macFUSE and are beta. Docker targets are not supported.
274
295
 
275
296
  ---
276
297
 
@@ -285,6 +306,7 @@ sshx/
285
306
  │ ├── config/ # YAML configuration
286
307
  │ ├── protocol/ # Client-server wire protocol
287
308
  │ ├── bridge/ # Command bridge (remote → local execution)
309
+ │ ├── remotefs/ # FS protocol, secure backend, and FUSE adapter
288
310
  │ ├── ports/ # Port sniffing (/proc/net/tcp*)
289
311
  │ ├── forward/ # TCP forwarding
290
312
  │ ├── domain/ # DNS resolver
@@ -300,7 +322,8 @@ sshx/
300
322
  ## Roadmap
301
323
 
302
324
  - [x] **v1** — Command bridge (non-interactive), auto port forwarding, domain binding, shared server
303
- - [ ] **v2** — Streaming stdin for command bridge, remote FUSE mounting, GitHub binary releases, Windows client support
325
+ - [ ] **v2** — Streaming stdin for command bridge, GitHub binary releases, Windows client support
326
+ - [x] **remoteFs beta** — Bidirectional read-write workspace mounting on Linux/macOS clients and Linux targets
304
327
 
305
328
  ---
306
329
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hahahhh/sshx",
3
- "version": "0.0.3",
3
+ "version": "0.0.4-rc.0",
4
4
  "type": "module",
5
5
  "description": "Transparent SSH enhancement wrapper for OpenSSH",
6
6
  "repository": {