# getcmd

AI-powered CLI that converts natural language into safe, cross-platform terminal commands.

## Installation

```bash
npm install -g getcmd
```

## Quick Start

```bash
# Setup (one time)
getcmd setup

# 2. Use natural language commands
getcmd "show me which process is using port 3000"
getcmd "list files"
```

## Features

- **AI-Powered**: Uses AI for natural language understanding
- **Safety First**: Never executes commands, only displays them for copy-paste
- **Cross-Platform**: Generates commands for Linux, macOS, and Windows
- **One-Time Setup**: Configure once, use forever
- **Smart Detection**: Understands your project structure and environment

## Examples

| Natural Language | Generated Command |
|------------------|-------------------|
| `getcmd "check port 3000"` | `Get-NetTCPConnection -LocalPort 3000` (Windows) |
| `getcmd "find large files"` | `find . -type f -size +100M -exec ls -lh {} \;` (Linux) |
| `getcmd "show disk usage"` | `du -sh *` (Linux) / `Get-ChildItem | Measure-Object` (Windows) |
| `getcmd "start dev server"` | `npm run dev` (detects package.json) |

## Commands

### Basic Usage
```bash
getcmd "your natural language command"
```

### Configuration
```bash
getcmd setup     # Configure platform and API key
getcmd status    # Show current settings
getcmd reset     # Reset configuration
```

### Advanced
```bash
getcmd "command" --json           # JSON output
getcmd "command" --platform linux # Override platform
getcmd interactive               # Interactive mode
```


## Cross-Platform Intelligence

getcmd automatically generates the right commands for your platform:

**Linux/macOS:**
```bash
getcmd "list files" → ls -la
getcmd "check processes" → ps aux | head -20
```

**Windows:**
```bash
getcmd "list files" → Get-ChildItem -Force
getcmd "check processes" → Get-Process | Sort-Object CPU -Descending
```

## Safety Features

- **Display Only**: Never executes commands automatically
- **Safety Validation**: AI + rule-based safety checks
- **Destructive Detection**: Warns about dangerous operations
- **Copy-Paste Interface**: Maximum user control

## Interactive Mode

```bash
getcmd interactive
```

```
GetCmd Interactive Mode
Using saved platform: linux

What would you like to do? › show processes using most CPU

Commands for linux:
  1. ps aux --sort=-%cpu | head -20

What would you like to do? › exit
```

## Real-World Examples

```bash
# Development workflow
getcmd "start development server"
getcmd "install project dependencies"
getcmd "check if port 8080 is free"

# System monitoring
getcmd "show memory usage"
getcmd "find processes using most CPU"
getcmd "check disk space"

# Network debugging
getcmd "show which process is using port 3000"
getcmd "display network connections"
getcmd "check if server is running on port 8000"
```

## Configuration

Settings are stored in `~/.getcmd/config.json`:
```json
{
  "platform": "linux",
  "lastUsed": "2025-09-21T19:47:55.123Z"
}
```

## Two Versions

- **`getcmd`** - AI-powered (main)
- **`getcmd-pattern`** - Pattern-based (offline, limited)

## Requirements

- Node.js 14+
- Internet connection (for AI features)

## License

MIT © voidflux

## Contributing

Issues and PRs welcome! This tool prioritizes safety and never executes commands automatically.

---

**getcmd** - Get the right command for any task, powered by AI!