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 and alabaster-shellgenius themes.
  • 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, alabaster-shellgenius. 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.

Legacy top-level code_block_theme: "alabaster-shellgenius" is still honored, but new config should prefer shellgenius.theme. 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.0.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.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shellgenius-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 e50d8d7cd4f726f66534d250dd18d3be6cf118bc036e4a710b12b3999f98380f
MD5 4e3fbeb5bd08dba5194893d82a5412d8
BLAKE2b-256 9e629fcc1f20f3e5d53f9121f9962e3d4d68e3e44a558e28ec69d2f9acf9529e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shellgenius-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19d548df02ff0e22400cadb286c3335cde97fc156ede13ae138a3fd4fcca38bc
MD5 fa56a23a54ab47f845c87852843c6858
BLAKE2b-256 bb4aec500b6c1d52b3e75859dcd81b9c4733b7df037ae23c6c63b7c00e718310

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