Metadata-Version: 2.3
Name: sshi
Version: 0.1.1
Summary: Tiny SSH instance manager with JSON inventory and completions
Author: Jacob Sun
Author-email: Jacob Sun <jacobsun000@gmail.com>
License: MIT License
         
         Copyright (c) 2025 Jacob Sun
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
         IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
         DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
         OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
         OR OTHER DEALINGS IN THE SOFTWARE.
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# sshi

`sshi` is a tiny SSH instance manager that lets you store your cloud/server SSH details in a simple JSON inventory and connect to them quickly.

## Features

- Store SSH instances with `name`, `host`, `user`, `port`, `key`, and optional `jump` host.
- SSH into servers with `sshi <name>`.
- Run remote commands with `sshi <name> -- <command>`.
- List all instances with `sshi ls`.
- Add or remove instances: `sshi add`, `sshi rm`.
- Show or edit stored entries: `sshi show`, `sshi edit`.
- Quick connectivity check: `sshi test <name>`.
- Copy files with `sshi scp <name> SRC DST` (use `:` prefix for remote paths).

## Installation

### From Source

```bash
git clone https://github.com/jacobsun000/sshi.git
cd sshi
uv build
uv pip install dist/*.whl
```

### From PyPI (once published)

```bash
uv pip install sshi
```

This installs the `sshi` CLI into your environment.

## Usage

### Add a server

```bash
sshi add proj1-prod --host 12.34.56.78 --user ubuntu --key ~/.ssh/proj1-prod.pem --tags prod aws
```

### SSH into server

```bash
sshi proj1-prod
```

### Run remote command

```bash
sshi proj1-prod -- uptime
```

### List all servers

```bash
sshi ls
```

### Copy files

```bash
# local -> remote
sshi scp proj1-prod ./local.txt :/tmp/remote.txt

# remote -> local
sshi scp proj1-prod :/var/log/syslog ./syslog
```

### Connectivity test

```bash
sshi test proj1-prod
```

### Edit inventory manually

```bash
sshi edit
```

This opens the JSON file (by default: `~/.config/sshi/instances.json`) in your `$EDITOR`.

## Configuration File

Instances are stored in:

```
~/.config/sshi/instances.json
```

Example:

```json
{
  "instances": {
    "proj1-prod": {
      "host": "12.34.56.78",
      "user": "ubuntu",
      "port": 22,
      "key": "~/.ssh/proj1-prod.pem",
      "jump": "ubuntu@bastion.example.com",
      "tags": ["prod", "aws"]
    }
  }
}
```

## Development

Clone and install locally in editable mode:

```bash
git clone https://github.com/jacobsun000/sshi.git
cd sshi
uv pip install -e .
```

Run directly:

```bash
uv run sshi ls
```

## License

MIT License
