@ethanfly/sshx 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +427 -2
- package/bin/sshx.js +22 -0
- package/dist/cli/connect.d.ts +27 -0
- package/dist/cli/connect.d.ts.map +1 -0
- package/dist/cli/connect.js +182 -0
- package/dist/cli/connect.js.map +1 -0
- package/dist/cli/exec.d.ts +8 -0
- package/dist/cli/exec.d.ts.map +1 -0
- package/dist/cli/exec.js +53 -0
- package/dist/cli/exec.js.map +1 -0
- package/dist/cli/host.d.ts +35 -0
- package/dist/cli/host.d.ts.map +1 -0
- package/dist/cli/host.js +312 -0
- package/dist/cli/host.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +313 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/keygen.d.ts +9 -0
- package/dist/cli/keygen.d.ts.map +1 -0
- package/dist/cli/keygen.js +38 -0
- package/dist/cli/keygen.js.map +1 -0
- package/dist/cli/sftp.d.ts +9 -0
- package/dist/cli/sftp.d.ts.map +1 -0
- package/dist/cli/sftp.js +105 -0
- package/dist/cli/sftp.js.map +1 -0
- package/dist/cli/sync.d.ts +15 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +220 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli/tunnel.d.ts +8 -0
- package/dist/cli/tunnel.d.ts.map +1 -0
- package/dist/cli/tunnel.js +79 -0
- package/dist/cli/tunnel.js.map +1 -0
- package/dist/cli/utils.d.ts +40 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +115 -0
- package/dist/cli/utils.js.map +1 -0
- package/dist/core/client.d.ts +49 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/client.js +269 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/config.d.ts +109 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +624 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/exec.d.ts +25 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +88 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/keygen.d.ts +45 -0
- package/dist/core/keygen.d.ts.map +1 -0
- package/dist/core/keygen.js +233 -0
- package/dist/core/keygen.js.map +1 -0
- package/dist/core/known-hosts.d.ts +30 -0
- package/dist/core/known-hosts.d.ts.map +1 -0
- package/dist/core/known-hosts.js +201 -0
- package/dist/core/known-hosts.js.map +1 -0
- package/dist/core/metrics.d.ts +62 -0
- package/dist/core/metrics.d.ts.map +1 -0
- package/dist/core/metrics.js +207 -0
- package/dist/core/metrics.js.map +1 -0
- package/dist/core/session.d.ts +44 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +160 -0
- package/dist/core/session.js.map +1 -0
- package/dist/core/sftp.d.ts +80 -0
- package/dist/core/sftp.d.ts.map +1 -0
- package/dist/core/sftp.js +368 -0
- package/dist/core/sftp.js.map +1 -0
- package/dist/core/split-session.d.ts +42 -0
- package/dist/core/split-session.d.ts.map +1 -0
- package/dist/core/split-session.js +223 -0
- package/dist/core/split-session.js.map +1 -0
- package/dist/core/tunnel.d.ts +86 -0
- package/dist/core/tunnel.d.ts.map +1 -0
- package/dist/core/tunnel.js +405 -0
- package/dist/core/tunnel.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/skill/mcp-server.d.ts +4 -0
- package/dist/skill/mcp-server.d.ts.map +1 -0
- package/dist/skill/mcp-server.js +284 -0
- package/dist/skill/mcp-server.js.map +1 -0
- package/dist/skill/runner.d.ts +2 -0
- package/dist/skill/runner.d.ts.map +1 -0
- package/dist/skill/runner.js +97 -0
- package/dist/skill/runner.js.map +1 -0
- package/dist/skill/tools.d.ts +106 -0
- package/dist/skill/tools.d.ts.map +1 -0
- package/dist/skill/tools.js +218 -0
- package/dist/skill/tools.js.map +1 -0
- package/dist/sync/crypto.d.ts +25 -0
- package/dist/sync/crypto.d.ts.map +1 -0
- package/dist/sync/crypto.js +69 -0
- package/dist/sync/crypto.js.map +1 -0
- package/dist/sync/manager.d.ts +54 -0
- package/dist/sync/manager.d.ts.map +1 -0
- package/dist/sync/manager.js +140 -0
- package/dist/sync/manager.js.map +1 -0
- package/dist/sync/provider.d.ts +63 -0
- package/dist/sync/provider.d.ts.map +1 -0
- package/dist/sync/provider.js +216 -0
- package/dist/sync/provider.js.map +1 -0
- package/dist/tui/app.d.ts +30 -0
- package/dist/tui/app.d.ts.map +1 -0
- package/dist/tui/app.js +356 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/form.d.ts +20 -0
- package/dist/tui/form.d.ts.map +1 -0
- package/dist/tui/form.js +132 -0
- package/dist/tui/form.js.map +1 -0
- package/dist/tui/index.d.ts +4 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +6 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/screen.d.ts +24 -0
- package/dist/tui/screen.d.ts.map +1 -0
- package/dist/tui/screen.js +144 -0
- package/dist/tui/screen.js.map +1 -0
- package/dist/tui/screens/hosts.d.ts +40 -0
- package/dist/tui/screens/hosts.d.ts.map +1 -0
- package/dist/tui/screens/hosts.js +272 -0
- package/dist/tui/screens/hosts.js.map +1 -0
- package/dist/tui/sidebar.d.ts +19 -0
- package/dist/tui/sidebar.d.ts.map +1 -0
- package/dist/tui/sidebar.js +122 -0
- package/dist/tui/sidebar.js.map +1 -0
- package/dist/tui/theme.d.ts +15 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +57 -0
- package/dist/tui/theme.js.map +1 -0
- package/package.json +49 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EthanFeng
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,428 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo.svg">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/logo.svg">
|
|
5
|
+
<img src="assets/logo.svg" alt="sshx - Modern SSH Host Manager" width="780">
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@ethanfly/sshx"><img src="https://img.shields.io/npm/v/@ethanfly/sshx?color=22d3ee&labelColor=0f172a&logo=npm" alt="npm version"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@ethanfly/sshx"><img src="https://img.shields.io/npm/dm/@ethanfly/sshx?color=818cf8&labelColor=0f172a" alt="npm downloads"></a>
|
|
12
|
+
<a href="https://github.com/ethanfly/sshx/actions"><img src="https://img.shields.io/github/actions/workflow/status/ethanfly/sshx/build.yml?branch=master&color=34d399&labelColor=0f172a&label=build" alt="build status"></a>
|
|
13
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-e879f9?labelColor=0f172a" alt="license"></a>
|
|
14
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-67e8f9?labelColor=0f172a&logo=node.js&logoColor=67e8f9" alt="node version"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<b>现代化跨平台 SSH 客户端与主机管理工具</b><br>
|
|
19
|
+
终端交互 TUI · 快速命令行 CLI · AI Agent 原生 MCP 协议支持
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# sshx
|
|
25
|
+
|
|
26
|
+
跨平台 SSH 客户端。TypeScript + Node.js 实现,提供三种用法:
|
|
27
|
+
|
|
28
|
+
- **CLI**:命令行连接、执行、SFTP、隧道,以及主机增删改查
|
|
29
|
+
- **TUI**:交互式主机启动器,操作方式参考 [sshs](https://github.com/quantumsheep/sshs)
|
|
30
|
+
- **MCP**:给 AI Agent 用的 Model Context Protocol 服务
|
|
31
|
+
|
|
32
|
+
支持 Linux、macOS、Windows。不依赖本机 C++ 编译。
|
|
33
|
+
|
|
34
|
+
## 功能
|
|
35
|
+
|
|
36
|
+
- 密码、私钥(Ed25519 / RSA,可带口令)、SSH Agent 认证
|
|
37
|
+
- 主机配置里保存的密码会在 CLI 和 TUI 连接时自动使用,不再询问
|
|
38
|
+
- **分屏会话与实时监控看板**:连接后右侧实时展示 IP、账号、CPU、内存、硬盘、网络吞吐、NVIDIA 显卡状态;按 `F2` / `Ctrl+O` 自由折叠/展开
|
|
39
|
+
- **端到端加密云同步(`sshx sync`)**:支持 WebDAV(坚果云 / Nextcloud / 群晖)与 GitHub Gist,AES-256-GCM 客户端加密保护
|
|
40
|
+
- 主机增删改查,标签、备注、跳板机(ProxyJump)、ProxyCommand
|
|
41
|
+
- 导入 OpenSSH `~/.ssh/config`,导入 / 导出 JSON 配置
|
|
42
|
+
- 本地转发 `-L`、远程转发 `-R`、SOCKS5 动态转发 `-D`
|
|
43
|
+
- SFTP 列目录、上传、下载、删除
|
|
44
|
+
- 会话可录制成 Asciinema v2 `.cast`
|
|
45
|
+
- 主机密钥校验,写入 `~/.ssh/known_hosts`
|
|
46
|
+
|
|
47
|
+
## 环境要求
|
|
48
|
+
|
|
49
|
+
- Node.js 20 或更高(开发与测试使用 Node.js 22+)
|
|
50
|
+
- npm、pnpm 或 yarn 任一即可
|
|
51
|
+
|
|
52
|
+
## 安装
|
|
53
|
+
|
|
54
|
+
### 通过 npm 全局安装(推荐)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install -g @ethanfly/sshx
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
使用 pnpm 或 yarn 安装:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pnpm add -g @ethanfly/sshx
|
|
64
|
+
# 或
|
|
65
|
+
yarn global add @ethanfly/sshx
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
安装完成后,在终端直接输入 `sshx` 即可默认进入 TUI 启动器:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
sshx --help
|
|
72
|
+
sshx
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 免安装直接体验
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx @ethanfly/sshx
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 从源码安装
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/ethanfly/sshx.git
|
|
85
|
+
cd sshx
|
|
86
|
+
npm install
|
|
87
|
+
npm run build
|
|
88
|
+
npm link
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
使用 pnpm 时把上面的 `npm` 换成 `pnpm`。`npm link` 之后,任意目录都可以直接运行 `sshx`。
|
|
92
|
+
|
|
93
|
+
确认安装:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
sshx --help
|
|
97
|
+
sshx --version
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
不想全局链接时,在仓库目录里用:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
node bin/sshx.js --help
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 仅作为当前项目的命令
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npm install
|
|
110
|
+
npm run build
|
|
111
|
+
npx sshx host list
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 配置文件位置
|
|
115
|
+
|
|
116
|
+
三端共用同一份配置:
|
|
117
|
+
|
|
118
|
+
| 系统 | 目录 |
|
|
119
|
+
|------|------|
|
|
120
|
+
| Linux / macOS | `~/.config/sshx/`(或 `$XDG_CONFIG_HOME/sshx`) |
|
|
121
|
+
| Windows | `%APPDATA%\sshx\` |
|
|
122
|
+
|
|
123
|
+
- `hosts.json`:主机列表。密码和私钥路径写在这里,文件权限 `0600`
|
|
124
|
+
- `config.json`:客户端设置
|
|
125
|
+
- `keys/`:`sshx keygen` 生成的密钥
|
|
126
|
+
|
|
127
|
+
换机器时拷贝整个目录,或:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
sshx host export hosts.json
|
|
131
|
+
# 到另一台机器
|
|
132
|
+
sshx host import hosts.json
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
也可以用环境变量改位置:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
export SSHX_CONFIG_DIR=~/shared/sshx
|
|
139
|
+
export SSHX_HOSTS_FILE=~/shared/sshx/hosts.json
|
|
140
|
+
export SSHX_CONFIG_FILE=~/shared/sshx/config.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## 快速开始
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# 保存一台用密码登录的主机
|
|
147
|
+
sshx host add --name dev --host 192.168.1.10 --username root \
|
|
148
|
+
--auth password --password 'your-password'
|
|
149
|
+
|
|
150
|
+
# 保存一台用私钥登录的主机
|
|
151
|
+
sshx host add --name prod --host 10.0.0.5 --username ubuntu \
|
|
152
|
+
--auth key -i ~/.ssh/id_ed25519
|
|
153
|
+
|
|
154
|
+
# 列出、查看、修改、删除
|
|
155
|
+
sshx host list
|
|
156
|
+
sshx host show dev
|
|
157
|
+
sshx host edit dev --port 2222
|
|
158
|
+
sshx host remove dev
|
|
159
|
+
|
|
160
|
+
# 直接输入 sshx,默认直接打开交互式 TUI 启动器
|
|
161
|
+
sshx
|
|
162
|
+
|
|
163
|
+
# 也可以在打开 TUI 时预先输入搜索词或指定配色
|
|
164
|
+
sshx -s "prod"
|
|
165
|
+
sshx --color dracula
|
|
166
|
+
|
|
167
|
+
# 带有目标参数时直接连接;已保存密码的主机会自动填入密码,不再询问
|
|
168
|
+
sshx dev
|
|
169
|
+
sshx connect prod
|
|
170
|
+
|
|
171
|
+
# 不进交互界面,直接执行一条命令
|
|
172
|
+
sshx exec dev "uname -a"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
> **提示**:命令行直接输入 `sshx` 不带子命令时,默认直接进入 TUI 交互式启动器。也可显式运行 `sshx tui`。
|
|
176
|
+
|
|
177
|
+
## CLI
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
sshx connect user@192.168.1.100 -p 22
|
|
181
|
+
sshx connect internal-db -J bastion
|
|
182
|
+
sshx connect prod --record session.cast
|
|
183
|
+
sshx connect user@example.com -L 8080:localhost:80 -D 1080
|
|
184
|
+
|
|
185
|
+
sshx exec user@example.com "uptime" --json
|
|
186
|
+
sshx sftp ls user@example.com /var/log
|
|
187
|
+
sshx sftp get user@example.com /var/log/syslog ./syslog
|
|
188
|
+
sshx sftp put user@example.com ./config.json /etc/myapp/config.json
|
|
189
|
+
sshx sftp rm user@example.com /tmp/old.log
|
|
190
|
+
|
|
191
|
+
sshx tunnel user@remote -L 8080:127.0.0.1:80 -D 1080
|
|
192
|
+
|
|
193
|
+
sshx ls
|
|
194
|
+
sshx host list --json
|
|
195
|
+
sshx host test prod
|
|
196
|
+
sshx host import-ssh-config
|
|
197
|
+
sshx host export hosts.json
|
|
198
|
+
sshx host import hosts.json
|
|
199
|
+
|
|
200
|
+
sshx keygen -t ed25519 -f ~/.ssh/id_ed25519_new -C "me@laptop"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`sshx host add` 不带参数时会进入交互向导。常用参数:
|
|
204
|
+
|
|
205
|
+
| 参数 | 含义 |
|
|
206
|
+
|------|------|
|
|
207
|
+
| `-n, --name` | 配置名称 |
|
|
208
|
+
| `-H, --host` | 地址 |
|
|
209
|
+
| `-p, --port` | 端口,默认 22 |
|
|
210
|
+
| `-u, --username` | 用户名 |
|
|
211
|
+
| `-a, --auth` | `key` 或 `password` |
|
|
212
|
+
| `--password` | 要保存的密码 |
|
|
213
|
+
| `-i, --identity` / `-k, --key` | 私钥路径 |
|
|
214
|
+
| `-J, --jump` | 跳板机配置名 |
|
|
215
|
+
| `-t, --tags` | 标签 |
|
|
216
|
+
| `--notes` | 备注 |
|
|
217
|
+
|
|
218
|
+
## TUI
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
sshx tui
|
|
222
|
+
sshx tui -s "prod web"
|
|
223
|
+
sshx tui --color dracula
|
|
224
|
+
sshx tui --sort fancy
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
`--color` 可选 `default`、`dracula`、`nord`、`catppuccin`。`--sort` 可选 `name`(默认)、`none`(保持保存顺序)、`fancy`(收藏优先,其次最近连接)。
|
|
228
|
+
|
|
229
|
+
| 按键 | 作用 |
|
|
230
|
+
|------|------|
|
|
231
|
+
| 直接输入 | 实时搜索。空格分隔的词都要匹配名称、地址、用户、标签或备注 |
|
|
232
|
+
| Backspace | 删掉最后一个搜索字符 |
|
|
233
|
+
| ↑ ↓ / k j / Ctrl-K Ctrl-J | 移动 |
|
|
234
|
+
| PgUp PgDn / Home End | 翻页、跳到头尾 |
|
|
235
|
+
| Enter | 连接。已保存密码自动填入,结束后回到列表 |
|
|
236
|
+
| a | 新建主机 |
|
|
237
|
+
| e | 编辑选中主机 |
|
|
238
|
+
| d | 删除(需要输入 `yes`) |
|
|
239
|
+
| t | 测试延迟 |
|
|
240
|
+
| S | 云同步(WebDAV / Gist) |
|
|
241
|
+
| i | 导入 `~/.ssh/config` |
|
|
242
|
+
| * | 收藏 / 取消收藏 |
|
|
243
|
+
| Ctrl-R | 从磁盘重新加载 |
|
|
244
|
+
| Esc | 先清空搜索,搜索为空时退出 |
|
|
245
|
+
| Ctrl-C | 退出 |
|
|
246
|
+
|
|
247
|
+
新建和编辑表单里:Tab 或 ↑↓ 切换字段,Ctrl-S 保存,Esc 取消。密码显示为 `*`。
|
|
248
|
+
|
|
249
|
+
## 实时监控分屏会话
|
|
250
|
+
|
|
251
|
+
连接任意主机后,`sshx` 会在窗口右侧自动开启实时系统监控看板(终端宽度 ≥ 90 列时默认开启):
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
┌─────────────────────────────────┐
|
|
255
|
+
│ ✦ sshx monitor [F2 toggle] │
|
|
256
|
+
├─────────────────────────────────┤
|
|
257
|
+
│ 📌 SYSTEM │
|
|
258
|
+
│ User: root │
|
|
259
|
+
│ Host: prod-srv-01 │
|
|
260
|
+
│ IP: 10.0.0.5 │
|
|
261
|
+
│ OS: Ubuntu 24.04 LTS │
|
|
262
|
+
│ Up: 14d 6h 32m │
|
|
263
|
+
├─────────────────────────────────┤
|
|
264
|
+
│ ⚡ CPU 24C · 14.2% │
|
|
265
|
+
│ AMD Ryzen 9 3900X │
|
|
266
|
+
│ [███░░░░░░░░░░░░░░░░] 14.2% │
|
|
267
|
+
├─────────────────────────────────┤
|
|
268
|
+
│ 🧠 MEMORY │
|
|
269
|
+
│ [███████████░░░░░░░░] 48% │
|
|
270
|
+
│ Used: 15.2G / 31.9G │
|
|
271
|
+
├─────────────────────────────────┤
|
|
272
|
+
│ 💾 DISK (/) │
|
|
273
|
+
│ [███░░░░░░░░░░░░░░░░] 14% │
|
|
274
|
+
│ Size: 130G / 952G │
|
|
275
|
+
├─────────────────────────────────┤
|
|
276
|
+
│ 🌐 NETWORK │
|
|
277
|
+
│ ↓ RX: 1.2 MB/s ↑ TX: 840 KB/s│
|
|
278
|
+
├─────────────────────────────────┤
|
|
279
|
+
│ 🎮 GPU (NVIDIA) │
|
|
280
|
+
│ RTX 3060 Ti (41°C) │
|
|
281
|
+
│ [████░░░░░░░░░░░░░░░] 23% │
|
|
282
|
+
│ VRAM: 856MB / 8192MB (10%) │
|
|
283
|
+
└─────────────────────────────────┘
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
- **分屏会话**:左侧为完整 PTY 远程交互终端,右侧为监视看板。
|
|
287
|
+
- **快捷键**:会话中随时按 **`F2`** 或 **`Ctrl+O`**,即可一键折叠或展开右侧看板(折叠后终端铺满 100% 宽度)。
|
|
288
|
+
- **命令行选项**:若不希望显示看板,添加 `--no-sidebar` 参数即可:
|
|
289
|
+
```bash
|
|
290
|
+
sshx connect prod --no-sidebar
|
|
291
|
+
sshx prod --no-sidebar
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## 云同步(sshx sync)
|
|
295
|
+
|
|
296
|
+
`sshx sync` 提供**端到端加密(E2EE)**的配置同步能力。导出的主机数据在离开本机前全部使用 **AES-256-GCM + Scrypt** 通过你的主密码加密,即便第三方云盘泄露也无法解密配置、密码与私钥路径。
|
|
297
|
+
|
|
298
|
+
### 1. 配置同步源
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
sshx sync setup
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
通过交互向导配置,支持两种提供商:
|
|
305
|
+
- **WebDAV**:坚果云、Nextcloud、ownCloud、群晖 NAS、Alist 等
|
|
306
|
+
- **GitHub Gist**:使用 Personal Access Token 自动创建/更新私有密文 Gist
|
|
307
|
+
|
|
308
|
+
也支持直接通过命令行参数快速配置:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# 配置 WebDAV
|
|
312
|
+
sshx sync setup --provider webdav \
|
|
313
|
+
--url "https://dav.jianguoyun.com/dav/sshx/" \
|
|
314
|
+
--username "your@email.com" \
|
|
315
|
+
--password "your-app-token" \
|
|
316
|
+
--passphrase "your-master-password"
|
|
317
|
+
|
|
318
|
+
# 配置 GitHub Gist
|
|
319
|
+
sshx sync setup --provider gist \
|
|
320
|
+
--token "ghp_your_personal_access_token" \
|
|
321
|
+
--passphrase "your-master-password"
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### 2. 同步操作
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# 将本地主机列表加密上传到云端
|
|
328
|
+
sshx sync push
|
|
329
|
+
|
|
330
|
+
# 从云端下载并解密合并到本地
|
|
331
|
+
sshx sync pull
|
|
332
|
+
|
|
333
|
+
# 覆盖本地配置(不合并)
|
|
334
|
+
sshx sync pull --overwrite
|
|
335
|
+
|
|
336
|
+
# 查看同步状态与远端连通性
|
|
337
|
+
sshx sync status
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
> **TUI 快捷键**:在 `sshx tui` 启动器列表中直接按 **`S`** 键,亦可快速同步最新主机列表。
|
|
341
|
+
|
|
342
|
+
## MCP
|
|
343
|
+
|
|
344
|
+
在 Claude Code 或支持 MCP 的客户端中登记:
|
|
345
|
+
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"mcpServers": {
|
|
349
|
+
"sshx": {
|
|
350
|
+
"command": "sshx",
|
|
351
|
+
"args": ["mcp"]
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
免全局安装也可以直接用 `npx`:
|
|
358
|
+
|
|
359
|
+
```json
|
|
360
|
+
{
|
|
361
|
+
"mcpServers": {
|
|
362
|
+
"sshx": {
|
|
363
|
+
"command": "npx",
|
|
364
|
+
"args": ["-y", "@ethanfly/sshx", "mcp"]
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
工具:
|
|
371
|
+
|
|
372
|
+
1. `ssh_list_hosts` 列出主机
|
|
373
|
+
2. `ssh_get_host` 查看一台主机(含已存密码和密钥路径)
|
|
374
|
+
3. `ssh_add_host` 新建
|
|
375
|
+
4. `ssh_update_host` 修改
|
|
376
|
+
5. `ssh_delete_host` 删除
|
|
377
|
+
6. `ssh_list_keys` 列出本机私钥
|
|
378
|
+
7. `ssh_test_connection` 测连通和延迟
|
|
379
|
+
8. `ssh_exec` 执行远程命令
|
|
380
|
+
9. `ssh_sftp_list` / `ssh_upload_file` / `ssh_download_file` 文件操作
|
|
381
|
+
10. `ssh_system_info` 查看系统信息
|
|
382
|
+
11. `ssh_generate_key` 生成密钥
|
|
383
|
+
|
|
384
|
+
命令行也可以直接调:
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
sshx skill hosts
|
|
388
|
+
sshx skill exec dev "uname -a"
|
|
389
|
+
sshx skill inspect dev
|
|
390
|
+
sshx skill sftp-ls dev /var/log
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
## 开发
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
pnpm install
|
|
397
|
+
pnpm run build # 编译到 dist/
|
|
398
|
+
pnpm test # 编译并跑测试
|
|
399
|
+
pnpm run dev:tui # 不编译,直接开 TUI
|
|
400
|
+
pnpm run dev:cli -- --help
|
|
401
|
+
pnpm run dev:mcp
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
`scripts/build.sh` 是一条从干净依赖到可执行文件的构建脚本,CI 和本地都能用:
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
bash scripts/build.sh
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
它会安装依赖、用 `tsc` 编译、检查 `node bin/sshx.js --version` 能跑。默认用 npm;已经装了 pnpm 时用 pnpm。
|
|
411
|
+
|
|
412
|
+
推送到 `master` 或 `main`,以及打开 Pull Request 时,GitHub Actions 会在 Ubuntu 上执行同一套构建和测试。
|
|
413
|
+
|
|
414
|
+
## 测试
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
pnpm test
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
测试使用内置的模拟 SSH 服务,覆盖配置读写、密钥生成、连接与命令执行、SFTP、端口转发、CLI 和 MCP。
|
|
421
|
+
|
|
422
|
+
## 安全说明
|
|
423
|
+
|
|
424
|
+
`hosts.json` 里的密码是明文,只靠文件权限 `0600` 保护。不要把这个文件提交到 git,也不要放进共享目录以外的不受信任位置。导出文件同样包含密码。
|
|
425
|
+
|
|
426
|
+
## 许可
|
|
427
|
+
|
|
428
|
+
MIT
|
package/bin/sshx.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const realScript = fs.realpathSync(__filename);
|
|
8
|
+
const packageRoot = path.dirname(path.dirname(realScript));
|
|
9
|
+
const distCli = path.join(packageRoot, 'dist', 'cli', 'index.js');
|
|
10
|
+
|
|
11
|
+
let createCli;
|
|
12
|
+
if (fs.existsSync(distCli)) {
|
|
13
|
+
const mod = await import(distCli);
|
|
14
|
+
createCli = mod.createCli;
|
|
15
|
+
} else {
|
|
16
|
+
// If dist not built yet, fallback to tsx runner
|
|
17
|
+
const mod = await import('../src/cli/index.ts');
|
|
18
|
+
createCli = mod.createCli;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const program = createCli();
|
|
22
|
+
await program.parseAsync(process.argv);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HostProfile } from '../core/config.js';
|
|
2
|
+
export interface ConnectCliOptions {
|
|
3
|
+
port?: number | string;
|
|
4
|
+
user?: string;
|
|
5
|
+
identity?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
jump?: string;
|
|
8
|
+
record?: string;
|
|
9
|
+
sidebar?: boolean;
|
|
10
|
+
localForward?: string[];
|
|
11
|
+
remoteForward?: string[];
|
|
12
|
+
dynamicForward?: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare class TargetNotFoundError extends Error {
|
|
15
|
+
target: string;
|
|
16
|
+
suggestions: HostProfile[];
|
|
17
|
+
constructor(target: string, suggestions: HostProfile[], allHosts?: HostProfile[]);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolves destination argument into a HostProfile
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveTarget(target: string, options?: ConnectCliOptions): HostProfile;
|
|
23
|
+
export interface RunConnectOptions extends ConnectCliOptions {
|
|
24
|
+
noExitOnError?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function runConnect(target: string, options?: RunConnectOptions): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/cli/connect.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,WAAW,EAAuB,MAAM,mBAAmB,CAAC;AAO3F,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,EAAE,CAAC;IAElC,YAAY,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,QAAQ,GAAE,WAAW,EAAO,EAiBnF;CACF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,WAAW,CAqF1F;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgF/F"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import { defaultConfigManager, resolvePortablePath } from '../core/config.js';
|
|
5
|
+
import { SSHConnection } from '../core/client.js';
|
|
6
|
+
import { SplitSession } from '../core/split-session.js';
|
|
7
|
+
import { TunnelManager, parsePortForwardString } from '../core/tunnel.js';
|
|
8
|
+
import { colors, prompt } from './utils.js';
|
|
9
|
+
export class TargetNotFoundError extends Error {
|
|
10
|
+
target;
|
|
11
|
+
suggestions;
|
|
12
|
+
constructor(target, suggestions, allHosts = []) {
|
|
13
|
+
let msg = `Host profile or address '${target}' not found.`;
|
|
14
|
+
if (suggestions.length > 0) {
|
|
15
|
+
msg += `\n\n${colors.yellow}Did you mean one of these?${colors.reset}`;
|
|
16
|
+
for (const s of suggestions) {
|
|
17
|
+
msg += `\n ${colors.cyan}• ${s.name}${colors.reset} (${s.username}@${s.host}:${s.port})`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (allHosts.length > 0) {
|
|
21
|
+
msg += `\n\nRun '${colors.bold}sshx host list${colors.reset}' to view all saved host profiles.`;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
msg += `\n\nNo saved hosts. Run '${colors.bold}sshx host add${colors.reset}' to create a profile.`;
|
|
25
|
+
}
|
|
26
|
+
super(msg);
|
|
27
|
+
this.name = 'TargetNotFoundError';
|
|
28
|
+
this.target = target;
|
|
29
|
+
this.suggestions = suggestions;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolves destination argument into a HostProfile
|
|
34
|
+
*/
|
|
35
|
+
export function resolveTarget(target, options = {}) {
|
|
36
|
+
const envPassword = process.env.SSH_PASSWORD;
|
|
37
|
+
const password = options.password || envPassword;
|
|
38
|
+
// 1. Direct match: check if target matches existing profile name, id, or host
|
|
39
|
+
let existing = defaultConfigManager.getHost(target);
|
|
40
|
+
// 2. Check if target is in [user@]profile format
|
|
41
|
+
let userPrefix;
|
|
42
|
+
if (!existing && target.includes('@') && !target.includes(':')) {
|
|
43
|
+
const atIdx = target.indexOf('@');
|
|
44
|
+
userPrefix = target.slice(0, atIdx);
|
|
45
|
+
const profileName = target.slice(atIdx + 1);
|
|
46
|
+
existing = defaultConfigManager.getHost(profileName);
|
|
47
|
+
}
|
|
48
|
+
if (existing) {
|
|
49
|
+
const keyPath = options.identity || existing.privateKeyPath;
|
|
50
|
+
const resolvedPassword = options.password || existing.password || envPassword;
|
|
51
|
+
return {
|
|
52
|
+
...existing,
|
|
53
|
+
port: options.port ? Number(options.port) : existing.port,
|
|
54
|
+
username: options.user || userPrefix || existing.username,
|
|
55
|
+
privateKeyPath: keyPath ? resolvePortablePath(keyPath, defaultConfigManager.getConfigDir()) : undefined,
|
|
56
|
+
password: resolvedPassword,
|
|
57
|
+
authType: options.password ? 'password' : (options.identity ? 'privateKey' : existing.authType),
|
|
58
|
+
proxyJump: options.jump || existing.proxyJump
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// Check if target looks like an explicit address vs mistyped profile name
|
|
62
|
+
const isExplicitAddress = target.includes('@') ||
|
|
63
|
+
target.includes(':') ||
|
|
64
|
+
target.includes('.') ||
|
|
65
|
+
target.toLowerCase() === 'localhost' ||
|
|
66
|
+
Boolean(options.user || options.port || options.identity || options.password);
|
|
67
|
+
const allHosts = defaultConfigManager.getHosts();
|
|
68
|
+
if (!isExplicitAddress && allHosts.length > 0) {
|
|
69
|
+
const suggestions = defaultConfigManager.suggestHosts(target);
|
|
70
|
+
throw new TargetNotFoundError(target, suggestions, allHosts);
|
|
71
|
+
}
|
|
72
|
+
// Parse [user@]hostname[:port]
|
|
73
|
+
let username = options.user || os.userInfo().username || 'root';
|
|
74
|
+
let host = target;
|
|
75
|
+
let port = options.port ? Number(options.port) : 22;
|
|
76
|
+
if (host.includes('@')) {
|
|
77
|
+
const parts = host.split('@');
|
|
78
|
+
username = parts[0];
|
|
79
|
+
host = parts[1];
|
|
80
|
+
}
|
|
81
|
+
if (host.includes(':')) {
|
|
82
|
+
const parts = host.split(':');
|
|
83
|
+
host = parts[0];
|
|
84
|
+
port = Number(parts[1]) || 22;
|
|
85
|
+
}
|
|
86
|
+
const defaultKey = path.join(os.homedir(), '.ssh', 'id_ed25519');
|
|
87
|
+
const defaultRsa = path.join(os.homedir(), '.ssh', 'id_rsa');
|
|
88
|
+
let privateKeyPath = options.identity;
|
|
89
|
+
if (!privateKeyPath && !password) {
|
|
90
|
+
if (fs.existsSync(defaultKey))
|
|
91
|
+
privateKeyPath = defaultKey;
|
|
92
|
+
else if (fs.existsSync(defaultRsa))
|
|
93
|
+
privateKeyPath = defaultRsa;
|
|
94
|
+
}
|
|
95
|
+
if (privateKeyPath) {
|
|
96
|
+
privateKeyPath = resolvePortablePath(privateKeyPath, defaultConfigManager.getConfigDir());
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
id: `temp_${Date.now()}`,
|
|
100
|
+
name: target,
|
|
101
|
+
host,
|
|
102
|
+
port,
|
|
103
|
+
username,
|
|
104
|
+
authType: password ? 'password' : (privateKeyPath ? 'privateKey' : 'password'),
|
|
105
|
+
password,
|
|
106
|
+
privateKeyPath,
|
|
107
|
+
proxyJump: options.jump
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export async function runConnect(target, options = {}) {
|
|
111
|
+
let profile;
|
|
112
|
+
try {
|
|
113
|
+
profile = resolveTarget(target, options);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
if (err instanceof TargetNotFoundError) {
|
|
117
|
+
process.stderr.write(`${colors.red}Error: ${err.message}${colors.reset}\n`);
|
|
118
|
+
if (options.noExitOnError)
|
|
119
|
+
throw err;
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
throw err;
|
|
123
|
+
}
|
|
124
|
+
// Prompt only when this connection has no stored or supplied password.
|
|
125
|
+
if (!profile.password && profile.authType !== 'agent' && profile.authType !== 'privateKey') {
|
|
126
|
+
profile.password = await prompt(`${colors.cyan}${profile.username}@${profile.host}'s password: ${colors.reset}`, true);
|
|
127
|
+
}
|
|
128
|
+
process.stdout.write(`${colors.dim}Connecting to ${colors.reset}${colors.bold}${profile.username}@${profile.host}:${profile.port}${colors.reset}...\n`);
|
|
129
|
+
const connection = new SSHConnection({ profile });
|
|
130
|
+
try {
|
|
131
|
+
await connection.connect();
|
|
132
|
+
process.stdout.write(`${colors.green}✓ Connected successfully.${colors.reset}\n`);
|
|
133
|
+
// Setup tunnels if requested
|
|
134
|
+
const tm = new TunnelManager(connection.getRawClient());
|
|
135
|
+
if (options.localForward) {
|
|
136
|
+
for (const spec of options.localForward) {
|
|
137
|
+
const tunnelConfig = parsePortForwardString(spec, 'local');
|
|
138
|
+
const tunnel = await tm.addTunnel(tunnelConfig);
|
|
139
|
+
await tunnel.start();
|
|
140
|
+
process.stdout.write(`${colors.green}✓ Forwarding local port ${tunnelConfig.localPort} -> ${tunnelConfig.remoteHost}:${tunnelConfig.remotePort}${colors.reset}\n`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (options.remoteForward) {
|
|
144
|
+
for (const spec of options.remoteForward) {
|
|
145
|
+
const tunnelConfig = parsePortForwardString(spec, 'remote');
|
|
146
|
+
const tunnel = await tm.addTunnel(tunnelConfig);
|
|
147
|
+
await tunnel.start();
|
|
148
|
+
process.stdout.write(`${colors.green}✓ Forwarding remote port ${tunnelConfig.remotePort} -> local ${tunnelConfig.localPort}${colors.reset}\n`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (options.dynamicForward) {
|
|
152
|
+
for (const spec of options.dynamicForward) {
|
|
153
|
+
const tunnelConfig = parsePortForwardString(spec, 'dynamic');
|
|
154
|
+
const tunnel = await tm.addTunnel(tunnelConfig);
|
|
155
|
+
await tunnel.start();
|
|
156
|
+
process.stdout.write(`${colors.green}✓ SOCKS5 proxy active on 127.0.0.1:${tunnelConfig.localPort}${colors.reset}\n`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Launch interactive split-pane session (Shell + Right monitor dashboard)
|
|
160
|
+
const splitSession = new SplitSession(connection.getRawClient(), {
|
|
161
|
+
enableSidebar: options.sidebar,
|
|
162
|
+
recordFilePath: options.record
|
|
163
|
+
});
|
|
164
|
+
await splitSession.start();
|
|
165
|
+
splitSession.attachToLocalProcess();
|
|
166
|
+
await new Promise((resolve) => {
|
|
167
|
+
splitSession.getSession().once('close', () => resolve());
|
|
168
|
+
});
|
|
169
|
+
await tm.stopAll();
|
|
170
|
+
connection.disconnect();
|
|
171
|
+
process.stdout.write(`\n${colors.dim}Connection closed.${colors.reset}\n`);
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
connection.disconnect();
|
|
175
|
+
process.stderr.write(`${colors.red}Connection failed: ${err.message || String(err)}${colors.reset}\n`);
|
|
176
|
+
if (options.noExitOnError) {
|
|
177
|
+
throw err;
|
|
178
|
+
}
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=connect.js.map
|