Shell Whiz

Shell Whiz is a command line AI assistant installed via pip or pipx that suggests the right terminal command for your task, runs as the sw CLI, and requires an OpenAI API key configured by sw config or the OPENAI_API_KEY environment variable.

CodingWeb AppBeginnerActive

Overview

Shell Whiz is an open source command line assistant that helps you find the right shell command for a task without digging through man pages or searching the web. You install it with pip or pipx and it adds the sw command to your PATH, then you ask questions using sw ask. Configuration requires an OpenAI API key, which you can set via sw config or the OPENAI_API_KEY environment variable, so usage costs and rate limits depend on your OpenAI account.

The README shows patterns for Bash and Zsh where sw can write a suggested command to a temporary file and a helper function can append it to history and execute it, which is powerful but requires careful review for safety. Advanced usage includes a preferences flag that lets you describe your environment, such as selecting Bash on Linux or PowerShell, and the docs recommend sw ask --help for additional options. Shell Whiz fits best for developers and operators who want faster command discovery and explanation, and who are comfortable validating commands before running them in production environments.

Key features

  • pip and pipx install: Install with pip install shell-whiz or pipx install shell-whiz to get the sw command
  • OpenAI key required: Configure an OpenAI API key using sw config or the OPENAI_API_KEY environment variable
  • Task to command: Ask for the right command for a task so you do not need to browse man pages each time
  • Alias friendly: Create an alias like ?? to call sw ask quickly during interactive terminal work
  • Shell preferences: Use the preferences option to set your shell and context so suggestions match your environment
  • History integration: Example functions can save suggested commands into history then execute them after writing to a file
  • PowerShell support: README provides a PowerShell function example that passes a model flag and preferences
  • Usage tracking: Documentation points to OpenAI usage pages so you can monitor API spend and consumption

Best for

  • Command discovery: Turn a natural language task into a concrete command for grep find curl git and system tools
  • Onboarding help: Help juniors learn safe commands faster by showing examples they can inspect and discuss
  • Daily ops speed: Reduce time spent searching documentation by getting direct command suggestions in context
  • Script drafting: Draft one liners for log parsing and file transforms then move them into scripts after review
  • PowerShell guidance: Produce PowerShell command ideas with a function wrapper that includes shell context
  • Repeatable aliases: Create a shortcut alias to ask questions quickly while keeping hands on the keyboard
  • Incident response: Quickly recall commands for triage and validation while still requiring human verification
  • Learning by iteration: Ask follow ups to refine flags and edge cases while building intuition about tools

Capabilities

sw ask workflow

Use sw ask to turn a task description into a suggested command. Treat output as a draft, inspect flags and paths, and run in a safe environment first when commands can modify data or affect production systems.

API key setup

Shell Whiz requires an OpenAI API key configured via sw config or OPENAI_API_KEY. Plan for API costs and keep keys out of shared shells by using environment management and least privilege practices.

Shell preferences

Use the preferences option to describe your OS and shell, such as Bash on Linux or PowerShell. This improves command accuracy and reduces mismatches caused by platform-specific syntax or tooling differences.

Review before run

The README shows examples that can write commands to a file and execute them via helper functions. Use this only with strict review habits, and avoid auto-executing suggestions on sensitive hosts or destructive tasks.

Frequently Asked Questions

Is Shell Whiz free to use?

The project is open source and free to install, but it requires an OpenAI API key. Your ongoing cost depends on OpenAI API usage, model choice, and how often you run sw ask in your workflow.

What are the legal and operational risks?

AI-generated commands can be unsafe or incorrect. You should review every command before running it, avoid executing on production by default, and follow your org policies for change control, logging, and incident response procedures.

How do I install and configure it?

The README shows installation via pip install shell-whiz or pipx install shell-whiz and it adds sw to your PATH. Configure your OpenAI key with sw config or the OPENAI_API_KEY environment variable before first use.

Does Shell Whiz integrate with shells and history?

Yes. The README includes examples for Bash and Zsh that can write a command to a temporary file, append it to history, and then eval it. Use these helpers carefully and test in a safe environment first.

How does Shell Whiz compare to searching the web?

Web search can be slower and inconsistent, while Shell Whiz provides command suggestions in the terminal with your context. It is best for quick drafts and learning, but you still need verification for correctness and security.

Tags