Skip to main content

ShellGenius is a tool to generate shell commands from description in natural language.

Project description

ShellGenius

ShellGenius turns task descriptions into shell commands.

ShellGenius demo

Installation

Install with uv (recommended):

uv tool install shellgenius

Or with pip:

python3 -m pip install shellgenius

OpenAI API key

ShellGenius requires an OpenAI API key. Get one from OpenAI's API key page, then store it with:

shellgenius key set

This writes the key to ~/.config/lmt/key.env. To edit it later:

shellgenius key edit

ShellGenius checks OPENAI_API_KEY first, then ~/.config/lmt/key.env.

On Windows, shellgenius key set also works. If you prefer an environment variable:

setx OPENAI_API_KEY your_key

Usage

Describe what you want in plain English:

shellgenius "show the ten largest directories in this repo"
shellgenius "find every .log file changed in the last hour"
shellgenius "rename all .jpeg files in the current dir to .jpg"

In an interactive terminal, ShellGenius shows the response with formatting and asks before execution. In non-interactive output, it prints the generated command:

cmd=$(shellgenius "print the current git branch name")
printf '%s\n' "$cmd"
shellgenius --cmd "show all files changed since origin/main"

Use --raw for plain-text output and --rich to force Rich rendering in a terminal.

Use --cmd when you want only the executable command, even in a TTY.

Options

Flag Effect
-m, --model Model to use (default: gpt-5.4-mini). Run shellgenius models to list options.
--no-stream Disable live Rich streaming.
-r, --raw Print the full response as plain text.
-R, --rich Force Rich formatting in a TTY; fall back to plain text otherwise.
--cmd Print only the command, even in a TTY.
--tokens Print prompt token count and estimated cost, then exit.

Shell Completion

Enable Click's generated completion for flags and explicit subcommand paths:

Bash

eval "$(_SHELLGENIUS_COMPLETE=bash_source shellgenius)"

Zsh

eval "$(_SHELLGENIUS_COMPLETE=zsh_source shellgenius)"

Checked-in scripts

Checked-in completion scripts are also available in completion/_complete_shellgenius.bash and completion/_complete_shellgenius.zsh.

Model Selection

List supported models and their short aliases:

shellgenius models

Use an alias with -m:

shellgenius -m 4.1 "list the ten largest files"
shellgenius -m 5.4-mini "find all TODO comments"

Customizing Colors

ShellGenius reads color settings from ~/.config/lmt/config.json. If the file is missing or unreadable, Rich's built-in defaults are used.

Shared keys

These lmterminal compatibility keys apply across tools:

  • code_block_theme — any Pygments style name, plus the built-in alabaster theme.
  • inline_code_theme — any Rich style string, such as "#325cc0 on #f0f0f0".

ShellGenius-only overrides

Add a shellgenius block to change ShellGenius without affecting other tools:

  • theme — ShellGenius's own preset. Built-in values: default, alabaster. Any Pygments theme name also works for fenced code blocks.
  • styles — override individual Rich semantic styles (markdown.h1, markdown.code, markdown.code_block). markdown.code overrides the top-level inline_code_theme for ShellGenius only; markdown.code_block controls the command-block background in TTY output.

Example:

{
  "code_block_theme": "alabaster",
  "inline_code_theme": "#325cc0 on #f0f0f0",
  "shellgenius": {
    "theme": "alabaster",
    "styles": {
      "markdown.code_block": "on #f0f0f0",
      "markdown.h1": "bold #325cc0"
    }
  }
}

Invalid styles entries are ignored individually, so one bad override does not discard the rest. The built-in alabaster preset keeps the upstream #f8f8f8 syntax background; for a darker command block, add {"markdown.code_block": "on #f0f0f0"} under styles.

These settings affect Rich output only; --raw and --cmd output is unchanged.

License

ShellGenius is released under the Apache 2.0 License.

https://github.com/sderev/shellgenius

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

shellgenius-0.2.1.tar.gz (405.7 kB view details)

Uploaded Source

Built Distribution

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

shellgenius-0.2.1-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file shellgenius-0.2.1.tar.gz.

File metadata

  • Download URL: shellgenius-0.2.1.tar.gz
  • Upload date:
  • Size: 405.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for shellgenius-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9a1eff7f313ee19c3917d600c27f9f3b4f3624b5966763986e9a4e8053e3f3df
MD5 8fe04e2577c4e18119309e446b27d2c9
BLAKE2b-256 b2a9b471eaa804f67a318d4939f18e363352cc89129d79db8190d490b8ea89d1

See more details on using hashes here.

File details

Details for the file shellgenius-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: shellgenius-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for shellgenius-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0e87a3b3edcae56af85cf8a8198aad59797c47d34c5b06d0f33b491d81a51e46
MD5 55a536d8c4c785fa10cdb541d774ae0b
BLAKE2b-256 d26e1d66dd8a7539632e96a4e7de19599b1675d10bd032bf342b52390a11251b

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