npm package: @mh-nikbakht/ssh-manager-cli
Description: A simple, cross-platform CLI tool for managing SSH connections. Store host details in a local SQLite database, securely manage passwords using your system's keychain (via keytar), and connect to hosts in your preferred terminal app. Supports interactive m
Author: mh-nikbakht
Latest version: 1.0.0

# SSH Manager

A simple, cross-platform CLI tool for managing SSH connections. Store host details in a local SQLite database, securely manage passwords using your system's keychain (via keytar), and connect to hosts in your preferred terminal app. Supports interactive mode for easy management and CLI commands for automation.

- **Platforms**: Primarily macOS and Linux. Windows is not fully supported (due to sshpass limitations), but you can use it with SSH keys or interactive passwords.

## Features

- Add, edit, list, and remove SSH hosts.

- Secure password storage (using system keychain).

- Non-interactive connections with stored passwords (requires sshpass).

- Open connections in Warp, Terminal.app, iTerm (macOS) or common Linux terminals (e.g., GNOME Terminal, Konsole).

- Install prerequisites like sshpass interactively or via CLI.

- Interactive menu for user-friendly management.

## Installation

### From NPM (Recommended)

Install globally for CLI access:

```bash

npm  install  -g  ssh-manager

```

This will make the `ssh-manager` command available in your terminal.

### From GitHub

Clone the repository and install dependencies:

```bash

git  clone  https://github.com/yourusername/ssh-manager.git

cd  ssh-manager

npm  install

npm  link  # Links the CLI globally for testing

```

## Prerequisites

- Node.js: v14 or higher.

- sshpass: For non-interactive password-based connections. The tool can install it for you on macOS (via Homebrew) or Linux (Debian/Ubuntu, RHEL/CentOS, Arch). Run ssh-manager install-prereq to install it.

- Terminal Apps (macOS): Warp, Terminal.app, or iTerm2.

- Linux Terminals: GNOME Terminal, Konsole, XFCE Terminal, or xterm (detected automatically).

- Windows: Limited support. Use SSH keys or WSL for better compatibility.

**Note**: Password storage uses your system's secure keychain (e.g., macOS Keychain, GNOME Keyring on Linux). No passwords are stored in plain text.

## Usage

### Interactive Mode

```bash

ssh-manager

```

This opens a menu where you can list hosts, add/edit/remove, connect, manage passwords, set default terminal, and install prerequisites.

### CLI Commands

Use `ssh-manager --help` for full details.

- List all hosts:

```bash
ssh-manager list
```

- Add or update a host:

```bash
ssh-manager add <name> <host> [-u <user>] [-p <port>] [-w <password>]
```

- If `-w` is provided without a value, it prompts securely for the password.
- Example: ssh-manager add myserver example.com -u myuser -p 2222 -w
- Connect to a host:

```bash
ssh-manager connect <name> [-t <terminal>]
```

- `-t`: Specify terminal (warp, terminal, iterm). Falls back to default if not provided.
- Uses stored password if available (non-interactive via sshpass).
- Example: `ssh-manager connect myserver -t warp`
- Remove a host:

  ```
  ssh-manager remove <name>
  ```

- Set default terminal (macOS only):

  ```
  ssh-manager set-terminal <terminal>  # warp, terminal, or iterm
  ```

- Remove stored password:

  ```bash
  ssh-manager remove-password <name>
  ```

- Install prerequisites (e.g., sshpass):
  ```bash
  ssh-manager install-prereq
  ```

## Configuration

- Database: Stored at ~/ssh_hosts.db (SQLite).
- Passwords: Stored securely via keytar (system keychain).
- Default Terminal: Set via set-terminal command or interactive menu. Defaults to Warp on macOS or system default on Linux.