@hadesgod/sshx
v0.0.6
Published
A modern CLI tool for managing SSH connections with interactive host selection and port forwarding capabilities.
Maintainers
Readme
SSHX
A modern CLI tool for managing SSH connections with interactive host selection and port forwarding capabilities.
Quick Start
# Using npx
npx @hadesgod/sshx
# Using npm
npm i -g @hadesgod/sshx
sshx
# Using bun
bun x @hadesgod/sshxFeatures
- 🔍 Interactive SSH host selection from your SSH config
- 🔄 Port forwarding setup with guided prompts
- 📋 Automatic command copying to clipboard
- 🎯 Support for custom ports and configurations
- 🚀 Built with TypeScript and Effect for robust error handling
Usage Examples
Basic SSH Connection
$ sshx
? Select a host to connect to my-server
# Copies: ssh my-serverSSH with Port Forwarding
$ sshx
? Select a host to connect to database-server
? Do you want to set up port forwarding? Yes
? Enter the remote port (e.g. 5432) for forwarding 5432
? Enter the local port (e.g. 5432) for forwarding 8432
# Copies: ssh -L 8432:localhost:5432 database-serverSSH with Custom Port
$ sshx
? Select a host to connect to custom-port-server
# Copies: ssh -p 2222 custom-port-serverHow It Works
When you run SSHX, it will:
- Read your SSH config file (~/.ssh/config)
- Present an interactive host selector
- Offer port forwarding configuration if needed
- Copy the final SSH command to your clipboard
Development
Prerequisites
- Bun v1.2.17 or later
- Node.js and npm (for development)
Setup
# Install dependencies
bun install
# Build the project
bun run build
# Run in development mode
bun run devProject Structure
src/
├── config/ # SSH config parsing and types
├── ssh/ # SSH command execution
├── ui/ # Interactive CLI components
└── utils/ # Utility functionsTech Stack
- Bun - JavaScript runtime and package manager
- Effect - Functional programming library
- @inquirer/prompts - Interactive CLI prompts
- TypeScript - Type safety and developer experience
Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Guidelines
- Follow TypeScript best practices
- Use Effect for error handling and functional programming patterns
- Maintain consistent code style using Biome
- Write meaningful commit messages
Testing
Note: Unit testing is currently in progress and will be improved in future updates. Contributions to test coverage are highly appreciated.
License
This project is licensed under the MIT License - see the LICENSE file for details.
