@hahahhh/sshx 0.0.2-rc.0 → 0.0.2

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 +36 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  > Transparent SSH enhancement — add remote-to-local commands, auto port forwarding, and local domains to your SSH workflow. Zero side effects when you don't need them.
4
4
 
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 with sshx-aware features enabled, you unlock a persistent, shared remote server that gives you:
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
8
  - 🔌 **Automatic port forwarding** — remote loopback listeners (e.g., a dev server on `localhost:8080`) are automatically detected and forwarded to your local machine.
9
9
  - 🌐 **Local domain binding** — access forwarded ports as `<host>.<your-user>.sshx:<port>` in your local browser, no manual `-L` flags needed.
10
+ - 🐳 **Docker container support** — target running containers by name or ID: `sshx my-container`. The same bridge, port forwarding, and domain features work inside containers via `docker exec`.
10
11
 
11
12
  ## Why sshx?
12
13
 
@@ -31,6 +32,16 @@ sshx is designed to be **safe to alias**. Hosts without sshx configuration are u
31
32
  - `~/.ssh/config` resolution is handled by OpenSSH — no reimplementation.
32
33
  - Bypass with `sshx --no-wrap` or `SSHX_DISABLE=1` at any time.
33
34
 
35
+ ### 🐳 Docker Container Target
36
+
37
+ When the target doesn't match any SSH host, sshx falls back to resolving it as a running Docker container:
38
+
39
+ - `sshx <container-name>` — opens a shell in the container via `docker exec`.
40
+ - `sshx <container-id-prefix>` — matches by container ID prefix.
41
+ - Explicit SSH targets (`user@host`, IP addresses, hostnames with dots/colons) are never treated as Docker containers.
42
+ - The full sshx feature set (command bridge, port detection, domain binding) works inside containers.
43
+ - Requires `docker` CLI available on the local machine — gracefully falls back to SSH if Docker isn't found or the container isn't running.
44
+
34
45
  ### 🔄 Remote-to-Local Command Bridge
35
46
 
36
47
  Run commands on your **local machine** from inside an SSH session:
@@ -128,6 +139,21 @@ sshx -p 2222 user@my-server hostname
128
139
 
129
140
  All existing SSH options work — `-F`, `-o`, `-J`, `ProxyJump`, etc. are handled by OpenSSH.
130
141
 
142
+ ### 1a. Connect to a Docker container
143
+
144
+ ```sh
145
+ # By container name
146
+ sshx my-dev-container
147
+
148
+ # By container ID prefix
149
+ sshx 4fa8bc
150
+
151
+ # Run a command directly
152
+ sshx my-container cat /etc/os-release
153
+ ```
154
+
155
+ sshx detects that the target isn't an SSH host and automatically uses `docker exec`. The command bridge and other features work exactly the same inside containers.
156
+
131
157
  ### 2. Try the command bridge
132
158
 
133
159
  Inside your SSH session on the remote:
@@ -216,7 +242,7 @@ commands:
216
242
  4. **Forwarding**: Detected ports are forwarded through a single shared local daemon using `ssh -W`.
217
243
  5. **Domains**: The local DNS responder maps `<target>.<suffix>` → localhost. The browser's URL port selects the local forwarded port.
218
244
 
219
- When `sshx` is invoked for a **non-matching host** (no sshx config, or host not in scope), it `exec`s the real `ssh` directly — no daemon, no installation, no overhead.
245
+ When `sshx` is invoked for a **non-matching host** (no sshx config, or host not in scope), it first checks if the target resolves to a running Docker container. If neither SSH nor Docker matches, it `exec`s the real `ssh` directly — no daemon, no installation, no overhead.
220
246
 
221
247
  ---
222
248
 
@@ -225,20 +251,22 @@ When `sshx` is invoked for a **non-matching host** (no sshx config, or host not
225
251
  - `sshx --no-wrap ...` — skip all sshx behavior and call raw `ssh`.
226
252
  - `SSHX_DISABLE=1 sshx ...` — same as `--no-wrap`, useful in scripts.
227
253
  - `sshx local ...` on a **client** (not inside a remote session) — errors immediately with a clear message. `local` is globally reserved.
254
+ - Docker containers that aren't running or can't be reached are pure passthrough — sshx falls back to raw `ssh` with no side effects.
228
255
  - Unmatched hosts are pure passthrough — no files created, no processes started.
229
256
 
230
257
  ---
231
258
 
232
259
  ## Platform Support
233
260
 
234
- | Platform | Client | Server |
235
- |---|---|---|
236
- | macOS | ✅ | — |
237
- | Linux | ✅ | ✅ |
238
- | Windows | 🔜 | — |
261
+ | Platform | Client | Server | Docker Client |
262
+ |---|---|---|---|
263
+ | macOS | ✅ | — | ✅ |
264
+ | Linux | ✅ | ✅ | ✅ |
265
+ | Windows | 🔜 | — | 🔜 |
239
266
 
240
267
  - **Client**: macOS and Linux are fully supported.
241
268
  - **Server**: Linux is required for the remote sshx server (uses `/proc/net/tcp*` for port detection).
269
+ - **Docker Client**: macOS and Linux — targets any running Docker container via `docker exec`.
242
270
 
243
271
  ---
244
272
 
@@ -248,7 +276,7 @@ When `sshx` is invoked for a **non-matching host** (no sshx config, or host not
248
276
  sshx/
249
277
  ├── cmd/sshx/ # Main entry point
250
278
  ├── internal/
251
- │ ├── cli/ # CLI parsing, host detection
279
+ │ ├── cli/ # CLI parsing, host detection, Docker container resolution
252
280
  │ ├── sshcompat/ # SSH argument compatibility
253
281
  │ ├── config/ # YAML configuration
254
282
  │ ├── protocol/ # Client-server wire protocol
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hahahhh/sshx",
3
- "version": "0.0.2-rc.0",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "description": "Transparent SSH enhancement wrapper for OpenSSH",
6
6
  "repository": {