npm package: @paynegh/terminal-gpt
Description: nlsh (Natural Language Shell) — talk to your terminal in plain English.
Latest version: 0.1.0

# nlsh - Natural Language Shell

Talk to your terminal in plain English.

> **Requirements**: macOS or Linux (Windows not currently supported)

## Install

### Option 0: npm (global)
```bash
# from the repo (until published on npm)
cd TerminalGPT
npm install
npm link

# now you can run:
nlsh
```

> Notes:
> - Requires Python 3 (`python3`) and pip.
> - Postinstall will run `python3 -m pip install --user -r requirements.txt`.
> - To skip pip install: `NLSH_SKIP_PIP=1 npm install`.


### Option 1: One-liner (curl)
```bash
bash <(curl -s https://raw.githubusercontent.com/PushDream/TerminalGPT/main/install.sh)
```

### Option 2: Clone and setup
```bash
git clone https://github.com/PushDream/TerminalGPT.git
cd TerminalGPT
./setup.sh
```

### Option 3: Download ZIP (no git needed)
```bash
wget https://github.com/PushDream/TerminalGPT/archive/refs/heads/main.zip
unzip main.zip
cd TerminalGPT-main
./setup.sh
```

### Option 4: Manual (minimal)
```bash
git clone https://github.com/PushDream/TerminalGPT.git
cd TerminalGPT
pip install google-generativeai
python nlsh.py
```

## Uninstall

```bash
curl -fsSL https://raw.githubusercontent.com/PushDream/TerminalGPT/main/uninstall.sh | bash
```

## Usage

```bash
nlsh
```

Type naturally:
- `list all python files` → `find . -name "*.py"`
- `git commit with message fixed bug` → `git commit -m "fixed bug"`
- `show me disk usage` → `df -h`

Or use shell commands directly - nlsh automatically detects when you're typing a command vs. natural language.

## Features

### Core Features
- **Natural language to shell commands** - Powered by Google Gemini AI
- **Smart command detection** - Automatically distinguishes between natural language and direct shell commands
- **Command history context** - AI remembers recent commands for context-aware suggestions
- **Editable AI suggestions** - Modify suggested commands before execution

### Enhanced Features (v2.0.0+)
- **Persistent command history** - History saved across sessions (`~/.nlsh_history`)
- **Tab completion** - Autocomplete file paths and commands
- **Environment variable expansion** - Support for `$HOME`, `$USER`, etc.
- **Built-in commands** - `exit`, `quit`, `clear` work as expected
- **Improved command detection** - 40+ additional shell commands recognized
- **Interactive program support** (v2.1.0) - Run `nano`, `vim`, `htop`, and other interactive programs directly
- **Smart OS/shell detection** (v2.2.0) - AI automatically adapts to your OS (Linux/macOS) and shell (bash/zsh/fish)

## Commands

- `!api` - Change API key
- `!version` - Show version
- `!history` - Show command history
- `!help` - Show help
- `!<cmd>` - Run any command directly (e.g., `!git status`)
- `exit` or `quit` - Exit nlsh
- `clear` - Clear screen
- `Ctrl+D` - Exit
- `Ctrl+C` - Cancel current operation

## Credits

**Original author**: [Junaid Mahmood](https://github.com/junaid-mahmood/nlsh)

**Enhanced by**: [PushDream](https://github.com/PushDream) - v2.0.0+ improvements including:
- Persistent readline history with file storage
- Tab completion for paths and commands
- Exit/quit/clear built-in commands
- Environment variable expansion
- Editable AI command suggestions
- Version tracking
- Expanded shell command detection (40+ additional commands)
- Synchronized history between readline and AI context
- Interactive program support (v2.1.0) - nano, vim, htop, etc.
- Smart OS/shell detection (v2.2.0) - AI adapts to Linux/macOS and bash/zsh/fish