# smartly

> A command-line tool that turns a plain English sentence into a single shell command using an LLM and runs it.

smartly is an open-source command-line tool by Rizwan Reza that sends one plain English sentence to an LLM, validates that the reply is a single shell command line, and runs it. It targets macOS and Linux with bash or zsh, and the latest listed release is v0.2.0.

## What It Is

smartly is a natural-language shell assistant for people who know what they want to do but would rather not remember exact flags. The interface is `smartly <request in plain English>`, for example turning "show hidden files sorted by size" into `ls -lahS`. It returns one command line per invocation; pipes, `&&` and redirects are allowed, but multi-step scripts are not.

## How It Builds Commands

By default it sends the request together with a capped directory listing and git branch, status and worktree information, so references like "all worktrees except main" resolve against what exists. It detects whether tools such as `sed`, `date` and `stat` are GNU or BSD and writes matching flags. Context levels are `none`, `light` (default) and `full`; `full` adds recent shell history and should be enabled deliberately because that history is sent to the LLM provider.

## Execution Modes and Safety

Auto-run is the default, including for destructive commands. Alternatives are `confirm`, which asks `[y/N]` every time, and `confirm-destructive`, which uses a local static classifier and asks on anything not recognised as safe. The documentation describes this classifier as a best-effort seatbelt rather than a sandbox. `--dry-run` prints the command without running it, and `--learn` explains the command piece by piece without running it. Every generate-and-run invocation is appended to a JSONL log that stores requests and commands verbatim.

## Providers and Setup

Four providers are supported: `anthropic` (default, via API key), `openai` (any OpenAI-compatible endpoint, including local vLLM, Ollama or LM Studio), and `claude-cli` and `codex-cli`, which use an existing logged-in CLI session. Install with Homebrew or `go install`, then optionally run `smartly onboard` to choose a provider, model and execution mode. Shell integration via `smartly init` lets generated `cd` or `export` commands affect the current shell. Windows and PowerShell are not supported yet.

## Features
- Turns plain English into a single shell command
- Detects GNU vs BSD userland differences
- Directory and git context awareness
- Execution modes: auto, confirm, confirm-destructive, dry-run
- Learn mode explaining each flag and pipe
- Multiple providers including API keys or existing CLI sessions
- OpenAI-compatible endpoint support
- Interactive onboarding command
- Shell integration for bash and zsh
- Append-only JSONL request log with risk classification

## Integrations
Anthropic, OpenAI, Claude Code CLI, Codex CLI, Ollama, vLLM, LM Studio, Homebrew, bash, zsh, Git

## Platforms
WINDOWS, MACOS, LINUX, API, CLI

## Pricing
Open Source

## Version
v0.2.0

## Links
- Website: https://smartlycli.com
- Documentation: https://smartlycli.com/docs/getting-started/
- Repository: https://github.com/rizwanreza/smartly-cli
- EveryDev.ai: https://www.everydev.ai/tools/smartly
