detached-shell 0.1.0

Noras.tech's minimalist detachable shell solution ยท zero configuration ยท not a complex multiplexer, just persistent sessions
Documentation

NDS - Noras Detached Shell ๐Ÿš€

Rust License: MIT PRs Welcome

Simple detachable shell sessions with zero configuration. Not a complex multiplexer like tmux or screen - just clean, persistent sessions you can attach and detach as needed.

Features โ€ข Installation โ€ข Usage โ€ข Documentation โ€ข Contributing

โœจ Features

  • ๐ŸŽฏ Simple Session Management: Create, detach, and reattach shell sessions with ease
  • ๐Ÿชถ Lightweight: < 1MB single binary with zero configuration required
  • โšก Fast: Written in Rust for maximum performance
  • ๐ŸŽจ User-Friendly: Intuitive commands with partial ID matching
  • ๐Ÿ–ฅ๏ธ Interactive Mode: Visual session picker with arrow key navigation
  • ๐Ÿ“ Session History: Track all session events with persistent history
  • ๐Ÿงน Auto-Cleanup: Automatic cleanup of dead sessions
  • ๐Ÿ”„ Session Switching: Simple attach/detach without complex multiplexing
  • ๐Ÿท๏ธ Named Sessions: Give meaningful names to your sessions
  • ๐Ÿง Cross-Platform: Works on Linux and macOS

๐ŸŽฏ Philosophy

NDS transforms your normal shell into a detachable, persistent session without changing how you work. No panes, no tabs, no complex layouts - just your shell, but better. When you need splits or tabs, your terminal emulator already handles that perfectly. NDS does one thing exceptionally well: making any shell session detachable and persistent.

๐Ÿ“ฆ Installation

Using Cargo

cargo install detached-shell

From Source

# Clone the repository
git clone https://github.com/NorasTech/detached-shell.git
cd detached-shell

# Build and install (recommended)
./scripts/install.sh

# Or manually
cargo build --release
sudo cp target/release/nds /usr/local/bin/

๐Ÿš€ Quick Start

# Create a new session
nds new

# List sessions
nds list

# Attach to a session
nds attach abc123

# Detach from current session
# Press Enter, then ~d (like SSH's escape sequences)

๐Ÿ“– Usage

Creating Sessions

# Create and attach to a new session
nds new

# Create a named session
nds new "project-dev"

# Create without attaching
nds new --no-attach

Managing Sessions

# List all active sessions
nds list
nds ls

# Interactive session picker
nds  # or nds list -i

# Attach to a session (supports partial ID matching)
nds attach abc123
nds a abc  # partial ID works

# Kill sessions
nds kill abc123
nds kill abc def ghi  # kill multiple sessions

# Clean up dead sessions
nds clean

Session Information

# Get detailed info about a session
nds info abc123

# Rename a session
nds rename abc123 "new-name"

# View session history
nds history              # Active sessions only
nds history --all        # Include archived sessions
nds history -s abc123    # History for specific session

Keyboard Shortcuts (Inside Session)

  • Enter, ~d - Detach from current session (like SSH's ~. sequence)

๐Ÿ—๏ธ Architecture

NDS uses a simple and robust architecture:

  • PTY Management: Each session runs in its own pseudo-terminal
  • Unix Sockets: Communication via Unix domain sockets
  • JSON Metadata: Session info stored in ~/.nds/sessions/
  • Per-Session History: History stored in ~/.nds/history/
  • Zero Dependencies: Minimal external dependencies for reliability

Directory Structure

~/.nds/
โ”œโ”€โ”€ sessions/       # Session metadata (JSON)
โ”œโ”€โ”€ sockets/        # Unix domain sockets
โ””โ”€โ”€ history/        # Session history
    โ”œโ”€โ”€ active/     # Currently running sessions
    โ””โ”€โ”€ archived/   # Terminated sessions

๐Ÿ”ง Configuration

NDS works out of the box with zero configuration. However, you can customize:

Environment Variables

# Change default shell (default: $SHELL or /bin/sh)
export NDS_SHELL=/bin/zsh

# Change detach key binding (coming soon)
export NDS_DETACH_KEY="ctrl-a d"

๐Ÿค Contributing

We love contributions! Please see CONTRIBUTING.md for details.

Development Setup

# Clone the repo
git clone https://github.com/NorasTech/detached-shell.git
cd detached-shell

# Run tests
cargo test

# Run with debug logs
RUST_LOG=debug cargo run -- list

# Quick rebuild and test
./scripts/dev.sh quick

Running Tests

# Run all tests
make test

# Run with coverage
cargo tarpaulin --out Html

# Run benchmarks
cargo bench

๐Ÿšง Project Status

Alpha Release - NDS is in active development. Core functionality is stable, but expect breaking changes.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Inspired by GNU Screen and tmux
  • Built with Rust ๐Ÿฆ€
  • Terminal handling via libc

๐Ÿ› Troubleshooting

Session not found after reboot

Sessions don't persist across system reboots by design. Use nds history --all to see past sessions.

Permission denied errors

Ensure ~/.nds/ directory has proper permissions:

chmod 700 ~/.nds
chmod 700 ~/.nds/sockets

Can't detach from session

Make sure you're using the correct key sequence: press Enter first, then ~d (similar to SSH's escape sequences).

๐Ÿ“ฎ Support