Skip to main content

Your favorite AI buddy right in your terminal

Project description

ShellSage

Usage

Installation

Install latest from the GitHub repository:

or from pypi

pip install shell_sage

We recommend also setting up your terminal editor of choice to keep the editor content's displayed in the terminal on exit. This allows ShellSage to see the files you have been working on. Here is how you can do this in vim:

echo "set t_ti= t_te=" >> ~/.vimrc

for neovim the above won't work.. but you can set it up in tmux:

set-option -g alternate-screen off

You will also need to get an Anthropic API key and set its environment variable:

export ANTHROPIC_API_KEY=sk...

How to use

ShellSage is designed to be ran inside a tmux session since it relies on tmux for getting what has is displayed on your terminal as context. If you don't want to use tmux, you will need to use the --NH command, which will not include your terminal history.

ssage hi ShellSage
Hello! I'm ShellSage, your command-line assistant. I can help you with:

- Bash commands and scripting
- System administration tasks
- Git operations
- File management
- Process handling
- And more!

You can also pipe outputs into ShellSage:

cat file.txt | ssage summarize this file

You can also select a specific pane for context to come from instead of the default current pane.

ssage --pid %3 your question

Tip: To use the pane-id selection feature, it is helpful to add set -g status-right '#{pane_id}' to your ~/.tmux.conf file. Once done, you can reload your tmux config with tmux source ~/.tmux.conf to have the pane id displayed on the right hand side of your tmux status bar.

Configuration

Sage uses a configuration file located at ~/.config/shell_sage/shell_sage.conf. You can overwrite these configurations by modifying this file or by passing the ShellSage CLI tool a specific argument. By default, ShellSage will use Anthropic's Claude Sonnet 3.5 model. However, you can also use any OpenAI model as well. For example, you can modify your configuration file to be the following:

[DEFAULT]
model = gpt-4o-mini
provider = openai
history_lines = -1
code_theme = monokai
code_lexer = python
sassy_mode = False

And now when you run ShellSage, it will use GPT 4o mini rather than Cloud Sonnet 3.5. From the command line, you could also do this:

ssage hi --provider openai --model gpt-4o-mini

Remember, this does require you to have set up your OpenAI API key as an environment variable.

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

shell_sage-0.0.4.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

shell_sage-0.0.4-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file shell_sage-0.0.4.tar.gz.

File metadata

  • Download URL: shell_sage-0.0.4.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for shell_sage-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9b58cd0eaa2f707f6f1508d69fe7a202aac19bde3c05f79e8f761ca95565478c
MD5 d1033795c8dc612ef09fdfedf0576b34
BLAKE2b-256 e16f53662bc6b4409ac863d26eaa7b49d5364719f9689dc9efcbd8841e18d245

See more details on using hashes here.

File details

Details for the file shell_sage-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: shell_sage-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for shell_sage-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6f6215154bb3dad1ca62058710642d9ee485736a2195c3df61cb43e2334e3f50
MD5 b8f37fbc5288a67f160f24a8dc4f71d2
BLAKE2b-256 a0e16225fe13805c22d64ae1a54207269c8e3e78fb119abbd6a301b843914aeb

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