Skip to main content

Plain English to shell commands, powered by Claude or Ollama

Project description

ShellSage

Plain English to shell commands, powered by Claude or Ollama.

PyPI PyPI Downloads Claude API Ollama Offline Capable License: MIT Python 3.10+


Demo

Demo


Installation

pip install shellsage-ai

After installing, run the one-time setup:

shellsage init

Quick Start

# Find all large files in your home directory
shellsage "find files larger than 100MB in my home directory"

# Create a new git branch and switch to it
shellsage "create a new git branch called feature/login and switch to it"

# Compress a folder
shellsage "compress the folder ./logs into a tar.gz archive"

# Kill a process on port 8080
shellsage "kill whatever process is running on port 8080"

# Bulk rename all .jpeg files to .jpg
shellsage "rename all .jpeg files in this folder to .jpg"

Ollama Setup (Local AI)

ShellSage can run entirely offline using Ollama.

1. Install Ollama

Platform Command
macOS brew install ollama
Linux curl -fsSL https://ollama.com/install.sh | sh
Windows https://ollama.com/download

2. Pull a model

ollama pull llama3.2        # recommended — fast and capable
ollama pull qwen2.5:3b      # lightweight, great for slower machines
ollama pull mistral         # most capable open model

3. Start the server

ollama serve
# macOS: starts automatically from the menu bar app

4. Verify

curl http://localhost:11434/api/tags

Then run shellsage init and choose Ollama.


CLI Reference

Usage: shellsage [OPTIONS] [INTENT] COMMAND [ARGS]...

  Translate INTENT into shell commands using AI.

Arguments:
  INTENT  Plain English description of what you want to do.

Options:
  --dry-run           Show commands without executing them.
  --explain           Show per-token breakdown before prompting.
  --provider TEXT     Override configured provider: claude or ollama.
  --help              Show this message and exit.

Commands:
  init      Run the first-time setup wizard.
  config    Re-run the setup wizard to change settings.
  history   Print this session's command history.

Examples

# Preview without running
shellsage "delete all .log files" --dry-run

# Get a detailed explanation of each command
shellsage "set up a Python virtual environment" --explain

# Override provider for this run
shellsage "list docker containers" --provider claude

# View commands run this session
shellsage history

# Reconfigure at any time
shellsage config

Safety System

ShellSage has a two-layer safety system:

Hard Blocklist

The following commands are always blocked and can never run, regardless of context:

  • rm -rf /, rm -rf /*, rm -rf ~
  • dd if=/dev/zero, dd if=/dev/random, dd if=/dev/urandom
  • mkfs, chmod -R 777 /
  • Fork bombs: :(){ :|:& };:
  • Piping untrusted URLs into a shell: curl | bash, wget -O- | sh

Danger Levels

Each proposed command is shown with a color-coded panel:

Level Color Indicator
safe Green 🟢
caution Yellow 🟡
destructive Red 🔴

You always see the command and its danger level before being asked to run it. You can also press e at the confirmation prompt to get a detailed token-by-token explanation.


Switching Providers

shellsage config

This re-runs the interactive setup wizard where you can switch between Claude and Ollama, change models, and update your API key.


How It Works

  1. ShellSage detects your OS, shell, working directory, and installed tools.
  2. It sends your English intent to the configured LLM with a structured prompt.
  3. The LLM responds with a JSON plan containing one or more shell commands.
  4. ShellSage validates each command against the safety blocklist.
  5. You confirm (or explain, or skip) each command before it runs.
  6. If a command fails, ShellSage automatically attempts to self-correct using the error output.

Contributing

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Install dev dependencies: pip install -e ".[dev]" (package name on PyPI: shellsage-ai)
  4. Run tests: pytest tests/
  5. Submit a pull request.

Please keep pull requests focused on a single concern and include tests for new functionality.


License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shellsage_ai-0.1.2.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shellsage_ai-0.1.2-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file shellsage_ai-0.1.2.tar.gz.

File metadata

  • Download URL: shellsage_ai-0.1.2.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for shellsage_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 33b3e06e17977741c1c6924f36feb208716b1cc61642d08c2c60bc4f9aaa91b7
MD5 4d0ca38efda7260cd0da54a2aad6f3ff
BLAKE2b-256 864c0116a873f869241a9960b921390bfacb22cf3de396d9b6646b617ca5da6d

See more details on using hashes here.

File details

Details for the file shellsage_ai-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: shellsage_ai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for shellsage_ai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9c82d72b79bb086a578eaf6d5915e25674a09106f866bcb566d384079a436e7f
MD5 df035efba4fccd8dbda92a52b1a0c52e
BLAKE2b-256 4ff6fcff352fd1e4ee183b2f1809da24851b5b2edbd7c260de0030a398bafedc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page