GitHub - ricardoborges/lzy-cli: CLI assistant that turns natural language into Linux commands using AI

2 min read Original article โ†—

๐Ÿง Lzy โ€“ Natural Language to Bash CLI

Lzy is a command-line tool that uses AI to translate natural language into Linux bash commands, explains what the command does, and lets you choose whether to run, edit, or abort the execution.


โœจ Features

  • ๐Ÿ” Translates natural language into valid Bash commands.
  • ๐Ÿ“˜ Explains each command in natural language.
  • ๐Ÿ› ๏ธ Lets you review or edit the command before execution.
  • ๐Ÿ” Works with multiple AI providers.
  • ๐ŸŽจ Fancy terminal output with rich.

๐ŸŽฅ Demo

Watch the demo

Click the image above or watch on YouTube.


๐Ÿš€ Installation


๐Ÿ”ง Environment Variables

Lzy uses environment variables to configure the AI provider and its corresponding API key.

Required

Variable Description
CLI_PROVIDER Which provider to use: gemini, openai, together,...
*_API_KEY The API key for the chosen provider (see below)

Supported Providers

CLI_PROVIDER Required Variable
gemini GEMINI_API_KEY
openai OPENAI_API_KEY
together TOGETHER_API_KEY
nvidia NVIDIA_API_KEY
anthropic ANTHROPIC_API_KEY
groq GROQ_API_KEY
mistral MISTRAL_API_KEY

Optional

Variable Description
.env file You can use a .env file to load variables automatically (via python-dotenv)

Example .env file:

CLI_PROVIDER=gemini
GEMINI_API_KEY=your_google_api_key_here

๐Ÿงช Usage

lzy find all PDF files in the current directory

Youโ€™ll get a result like this:

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Command                             โ”ƒ Description                                  โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ find . -name '*.pdf'                โ”‚ Searches for all PDF files in the current    โ”‚
โ”‚                                     โ”‚ directory and its subdirectories.            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Then you're prompted to choose:

  • y: run the command
  • e: edit it first
  • n: cancel

๐Ÿงฉ Dev Tip

You can also run directly via Python for debugging:

python lzy/cli.py delete all .DS_Store files in this folder

๐Ÿ“œ License

MIT License