ssh-x-term 0.0.29

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Eugen Iofciu Vasile
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 ADDED
@@ -0,0 +1,219 @@
1
+ # SSH-X-Term
2
+
3
+ SSH-X-Term is a powerful terminal-based SSH client with a TUI (Text User Interface) built on [Bubble Tea](https://github.com/charmbracelet/bubbletea).
4
+ It lets you manage SSH connections, securely store credentials using Bitwarden, and connect to remote servers with both password and key-based authentication.
5
+ Cross-platform features include support for passh (Unix), plink.exe (Windows), and full tmux integration.
6
+
7
+ ![Screenshot](https://github.com/user-attachments/assets/a545d09b-2101-4c6d-b5b9-377b2d554d57)
8
+
9
+ ## Features
10
+
11
+ - Manage SSH connections in an interactive Bubble Tea TUI.
12
+ - Secure credential storage and retrieval via Bitwarden CLI.
13
+ - Password-based SSH login automation using passh (Unix) or plink.exe (Windows).
14
+ - Key-based SSH authentication.
15
+ - Open connections in new tmux windows or current terminal.
16
+ - Fullscreen and responsive TUI.
17
+
18
+ ## Project Structure
19
+
20
+ ```
21
+ ssh-x-term/
22
+ ├── cmd/
23
+ │ └── sxt/
24
+ │ └── main.go # Application entry point
25
+ ├── internal/
26
+ │ ├── config/
27
+ │ │ ├── config.go # Configuration handling
28
+ │ │ └── models.go # Configuration data models
29
+ │ ├── ssh/
30
+ │ │ ├── client.go # SSH client implementation
31
+ │ │ ├── session_unix.go # SSH session management (Unix)
32
+ │ │ └── session_windows.go # SSH session management (Windows)
33
+ │ └── ui/
34
+ │ ├── components/
35
+ │ │ ├── bitwarden_config.go # Bitwarden CLI configuration form/component
36
+ │ │ ├── bitwarden_login_form.go # Bitwarden login form component
37
+ │ │ ├── bitwarden_unlock_form.go # Bitwarden unlock form component
38
+ │ │ ├── connection_list.go # List of SSH connections
39
+ │ │ ├── form.go # Form for adding/editing connections
40
+ │ │ ├── storage_select.go # Credential storage selection (Bitwarden/etc.)
41
+ │ │ └── terminal.go # Terminal component for SSH sessions
42
+ │ ├── model.go # Main UI model
43
+ │ ├── update.go # Update logic for UI
44
+ │ └── view.go # View rendering logic
45
+ ├── pkg/
46
+ │ └── sshutil/
47
+ │ ├── auth.go # Authentication utilities (passh/plink, etc.)
48
+ │ ├── terminal_unix.go # Terminal utilities (Unix)
49
+ │ └── terminal_windows.go # Terminal utilities (Windows)
50
+ ├── go.mod
51
+ ├── go.sum
52
+ └── README.md
53
+ ```
54
+
55
+ **Note:**
56
+ - Bitwarden integration is handled via several UI components:
57
+ - `bitwarden_config.go`, `bitwarden_login_form.go`, `bitwarden_unlock_form.go` for configuration, login, and unlock flows.
58
+ - `storage_select.go` lets users choose Bitwarden or other credential storage.
59
+
60
+ **Flow chart**
61
+ - [FLOW](https://github.com/eugeniofciuvasile/ssh-x-term/blob/main/FLOW.md)
62
+
63
+ ## Prerequisites
64
+
65
+ - **Go 1.24+**
66
+ - **Bitwarden CLI (`bw`)** — for credential management ([install guide](https://bitwarden.com/help/cli/))
67
+ - **passh** — for password authentication on Unix ([compile it from here](https://github.com/clarkwang/passh))
68
+ - **tmux** — recommended for multi-window SSH sessions ([install guide](https://github.com/tmux/tmux/wiki/Installing))
69
+ - **plink.exe** — for password authentication on Windows ([download from PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html))
70
+ - **(Optional) ssh client** — `ssh` should be available on your system
71
+
72
+ **Ensure all required binaries are available in your `$PATH`.**
73
+
74
+ ## System dependencies
75
+
76
+ ssh-x-term requires the following system tools to be installed:
77
+
78
+ - `tmux`
79
+ - `passh`
80
+ - `bitwarden-cli` (npm package: `@bitwarden/cli`, install globally: `npm install -g @bitwarden/cli`)
81
+
82
+ ### Linux (Debian/Ubuntu):
83
+
84
+ ```sh
85
+ sudo apt update
86
+ sudo apt install -y tmux
87
+ npm install -g @bitwarden/cli
88
+ # follow github repo https://github.com/clarkwang/passh to compile passh
89
+ ```
90
+
91
+ ### macOS (with Homebrew):
92
+
93
+ ```sh
94
+ brew install tmux
95
+ npm install -g @bitwarden/cli
96
+ # follow github repo https://github.com/clarkwang/passh to compile passh
97
+ ```
98
+
99
+ ### Windows:
100
+
101
+ - Install `tmux` and `passh` via WSL/Cygwin or use alternatives.
102
+ - Install Bitwarden CLI with: `npm install -g @bitwarden/cli`
103
+
104
+ ## Installation
105
+
106
+ ### Option 1: Install using npm (Recommended)
107
+
108
+ The easiest way to install SSH-X-Term is using npm:
109
+
110
+ ```sh
111
+ # Install globally
112
+ npm install -g ssh-x-term
113
+
114
+ # Run the command
115
+ sxt
116
+ ```
117
+
118
+ This will automatically download the appropriate binary for your platform and set up the command.
119
+
120
+ The npm installer also attempts to install required dependencies (`bw`, `passh`, `tmux`) if they are not already available in your system's `$PATH`.
121
+
122
+ ---
123
+
124
+ ### Option 2: Build from source
125
+
126
+ Ensure you have **Go 1.21+** installed. You can use either the Go from your package manager or [install manually](https://go.dev/dl/).
127
+ If you manually install Go, add the following to your shell config (`~/.bashrc`, `~/.zshrc`, etc.):
128
+
129
+ ```sh
130
+ export GOROOT=/usr/local/go
131
+ export GOPATH=$HOME/go
132
+ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
133
+ ```
134
+
135
+ Then:
136
+
137
+ ```sh
138
+ # Clone and build the project
139
+ git clone https://github.com/eugeniofciuvasile/ssh-x-term.git
140
+ cd ssh-x-term
141
+ go build -o sxt ./cmd/sxt
142
+ ```
143
+
144
+ Or install globally with Go:
145
+
146
+ ```sh
147
+ go install github.com/eugeniofciuvasile/ssh-x-term/cmd/sxt@latest
148
+ ```
149
+
150
+ Make sure `$GOPATH/bin` is in your `$PATH` to use `sxt` from anywhere.
151
+
152
+ ---
153
+
154
+ ### Option 3: Download pre-built binary
155
+
156
+ You can download the pre-built binary for your platform from the [Releases](https://github.com/eugeniofciuvasile/ssh-x-term/releases) page.
157
+
158
+ After downloading:
159
+
160
+ ```sh
161
+ chmod +x sxt
162
+ mv sxt /usr/local/bin/ # or any location in your PATH
163
+ ```
164
+
165
+ ## Usage
166
+ 1. Run the app:
167
+ ```sh
168
+ ./sxt
169
+ # or, if installed globally:
170
+ sxt
171
+ ```
172
+
173
+ 2. **Manage SSH connections:**
174
+ - Press `a` to add, `e` to edit, `d` to delete a connection.
175
+ - Press `o` to toggle opening connections in a new tmux window.
176
+ - Press `Enter` to connect.
177
+ - Use arrow keys to navigate.
178
+ - All credentials are stored/retrieved using Bitwarden.
179
+
180
+ 3. **Connection Form:**
181
+ - Fill in fields as prompted.
182
+ - `Tab` to navigate, `Ctrl+p` to toggle auth type, `Enter` to submit, `Esc` to cancel.
183
+
184
+ 4. **SSH Session:**
185
+ - `Esc` to disconnect.
186
+ - Passwords are supplied securely via passh or plink.exe (never echoed or stored in plaintext).
187
+
188
+ ## Configuration
189
+
190
+ Config is stored at: `~/.config/ssh-x-term/ssh-x-term.json`
191
+ Connection secrets are stored in your Bitwarden vault.
192
+
193
+ ## Security Notes
194
+
195
+ - **Passwords are only handled via secure subprocesses (`passh`, `plink.exe`) and Bitwarden.**
196
+ - **No plaintext passwords are ever written to disk or logs.**
197
+
198
+ ## License
199
+
200
+ [MIT](LICENSE)
201
+
202
+ ## Disclaimer
203
+
204
+ SSH-X-Term is an independent open-source project released under the MIT License.
205
+ It is **not affiliated with, endorsed by, or supported by** any of the credited projects, including Bubble Tea, Bitwarden, passh, PuTTY/plink, or any other third-party software listed above.
206
+
207
+ **Security Notice:**
208
+ SSH-X-Term integrates with external tools for SSH and credential management.
209
+ The safe handling, storage, and security of your credentials (including passwords and keys) is ultimately your responsibility.
210
+ By using this software, you agree that the author and contributors bear **no liability** for any potential loss, compromise, or misuse of credentials or data.
211
+
212
+ For details, see the [MIT License](LICENSE).
213
+
214
+ ## Credits
215
+
216
+ - [Bubble Tea](https://github.com/charmbracelet/bubbletea)
217
+ - [Bitwarden CLI](https://bitwarden.com/help/cli/)
218
+ - [passh](https://github.com/clarkwang/passh)
219
+ - [PuTTY/plink.exe](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)
package/index.js ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const os = require('os');
5
+ const fs = require('fs');
6
+ const { spawnSync } = require('child_process');
7
+
8
+ // Platform and architecture
9
+ const platform = os.platform();
10
+ const arch = os.arch();
11
+ const ext = platform === 'win32' ? '.exe' : '';
12
+
13
+ // Map to GitHub release names
14
+ const platformMap = {
15
+ darwin: 'darwin',
16
+ linux: 'linux',
17
+ win32: 'windows'
18
+ };
19
+
20
+ const archMap = {
21
+ x64: 'amd64',
22
+ arm64: 'arm64'
23
+ };
24
+
25
+ // Define download paths
26
+ const installDir = path.join(os.homedir(), '.ssh-x-term');
27
+ const binName = `ssh-x-term-${platformMap[platform]}-${archMap[arch]}${ext}`;
28
+ const binaryPath = path.join(installDir, binName);
29
+
30
+ // Run the binary
31
+ function runBinary() {
32
+ // Check if the binary exists
33
+ if (!fs.existsSync(binaryPath)) {
34
+ console.error(`Binary not found at ${binaryPath}`);
35
+ console.error('Please reinstall the package with: npm install -g ssh-x-term');
36
+ process.exit(1);
37
+ }
38
+
39
+ // Make sure it's executable
40
+ if (platform !== 'win32') {
41
+ try {
42
+ fs.chmodSync(binaryPath, '755');
43
+ } catch (err) {
44
+ console.error(`Error making binary executable: ${err.message}`);
45
+ }
46
+ }
47
+
48
+ // Run the binary with any passed arguments
49
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
50
+ stdio: 'inherit'
51
+ });
52
+
53
+ // Forward the exit code
54
+ process.exit(result.status || 0);
55
+ }
56
+
57
+ // If this script is being executed directly, run the binary
58
+ if (require.main === module) {
59
+ runBinary();
60
+ }
61
+
62
+ // Export for programmatic usage
63
+ module.exports = {
64
+ run: runBinary
65
+ };
package/install.js ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+
3
+ const os = require('os');
4
+ const { spawnSync } = require('child_process');
5
+
6
+ const deps = [
7
+ { name: 'tmux', check: 'tmux' },
8
+ { name: 'passh', check: 'passh' },
9
+ { name: 'bw (bitwarden-cli)', check: 'bw' }
10
+ ];
11
+
12
+ function checkDep(cmd) {
13
+ const which = os.platform() === 'win32' ? 'where' : 'which';
14
+ const res = spawnSync(which, [cmd]);
15
+ return res.status === 0;
16
+ }
17
+
18
+ function checkDeps() {
19
+ let missing = [];
20
+ deps.forEach(dep => {
21
+ if (!checkDep(dep.check)) {
22
+ missing.push(dep.name);
23
+ }
24
+ });
25
+
26
+ if (missing.length > 0) {
27
+ console.warn('\nMissing system dependencies:');
28
+ missing.forEach(dep => console.warn(` - ${dep}`));
29
+ console.warn('\nPlease install these manually following the instructions in the README before using ssh-x-term.\n');
30
+ } else {
31
+ console.log('All system dependencies found.');
32
+ }
33
+ }
34
+
35
+ checkDeps();
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "ssh-x-term",
3
+ "version": "0.0.29",
4
+ "description": "TUI to handle multiple SSH connections simultaneously",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "sxt": "index.js"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node install.js"
11
+ },
12
+ "files": [
13
+ "bin",
14
+ "install.js",
15
+ "index.js",
16
+ "README.md"
17
+ ],
18
+ "keywords": [
19
+ "ssh",
20
+ "terminal",
21
+ "golang",
22
+ "cli"
23
+ ],
24
+ "author": "Eugen Iofciu Vasile",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/eugeniofciuvasile/ssh-x-term.git"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/eugeniofciuvasile/ssh-x-term/issues"
32
+ },
33
+ "homepage": "https://github.com/eugeniofciuvasile/ssh-x-term#readme",
34
+ "os": [
35
+ "linux",
36
+ "darwin"
37
+ ],
38
+ "engines": {
39
+ "node": ">=14.0.0"
40
+ }
41
+ }