Releases: TheR1D/shell_gpt
0.9.3
0.9.2
This release includes shell integrations for ZSH and Bash.
- Added simple shell integration for ZSH.
- Added simple shell integration for Bash.
- New hidden option
--install-integration
which will update user shell profile.
Shell Integration
Shell integration allows you to use Shell-GPT in your terminal with hotkeys. It is currently available for Bash and ZSH. It will allow you to have sgpt
completions in your shell history, and also edit suggested commands right away.
Shell_GPT_Integration.mp4
Installation
pip install --upgrade shell-gpt
sgpt --install-integration
# Restart your terminal to apply changes.
Usage
In your terminal enter natural language request, and press Ctrl+l
to get shell command suggestion. It will replace your current input line (buffer) with the GPT suggested command.
List all txt files in current folder (Ctrl+l)
# -> ls *.txt
Special thanks to @chinarjoshi
0.9.1
This release includes several new features, optimizations and bug fixes:
- New input option to describe command when executing using
--shell
. - New CLI option
--describe-shell
or-d
to generate explanation for commands. - Configuration parameter to execute shell commands by default.
- Comment lines (a line starting with #) excluded when parsing
.sgptrc
file. - Max limit of
--temperature
was change to 2. - Hiding API key from tracebacks when
sgpt
crashes. - Fixing a bug when typing
exit()
in REPL mode.
Describe shell commands
When executing a shell command suggestion using --shell
the prompt has be changed. There are 3 new options:
sgpt -s "show all txt files in current folder"
# -> ls *.txt
# -> [E]xecute, [D]escribe, [A]bort: d
# -> List all files with .txt extension in current directory
# -> [E]xecute, [D]escribe, [A]bort: e
...
Same logic works in --repl
mode:
sgpt -s --repl temp
Entering shell REPL mode, type [e] to execute commands or [d] to describe the commands, press Ctrl+C to exit.
>>> install docker
brew install docker
>>> d
Installs Docker using the Homebrew package manager.
>>> e
...
Added new option --describe-shell
or -d
. It allows you to generate explanation for shell commands:
sgpt -d "ls -la"
# -> List all files and directories, including hidden files, with permissions and ownership information.
Execute commands by default
New configuration parameter DEFAULT_EXECUTE_SHELL_CMD
(false
by default), if true
will executing commands when calling sgpt --shell
if no input was passed (enter). So we don't have to type "y" or "e" to execute command.
sgpt -s "say hi"
# -> echo hi
# -> [E]xecute, [D]escribe, [A]bort: (enter)
hi
Shoutout to all contributors: @chinarjoshi, @konstantin-goldman, @Daeinar, @eitamal, @cosmojg.
0.9.0
- Custom user defined roles.
- Option to change default roles like shell, code and default.
- Option to force use system role messages (not recommended).
- Improvements when passing stdin and prompt
echo hello | sgpt "another hello"
. - Fixed typo in
--list-chat
option renamed as--list-chats
Roles
ShellGPT allows you to create custom roles, which can be utilized to generate code, shell commands, or to fulfill your specific needs. To create a new role, use the --create-role
option followed by the role name. You will be prompted to provide a description for the role, along with other details. This will create a JSON file in ~/.config/shell_gpt/roles
with the role name. Inside this directory, you can also edit default sgpt
roles, such as shell, code, and default. Use the --list-roles
option to list all available roles, and the --show-role
option to display the details of a specific role. Here's an example of a custom role:
sgpt --create-role json
# Enter role description: You are JSON generator, provide only valid json as response.
# Enter expecting result, e.g. answer, code, shell command, etc.: json
sgpt --role json "random: user, password, email, address"
{
"user": "JohnDoe",
"password": "p@ssw0rd",
"email": "[email protected]",
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
}
}
Note that all previous chats which were created in previous version of ShellGPT will not work with this new version.
0.8.9
0.8.8
- Accept prompt from both stdin and command line argument.
This versatile feature is particularly useful when you need to pass file content or pipe output from other commands to the GPT models for summarization or analysis. For example, you can easily generate a git commit message based on a diff:
git diff | sgpt "Generate git commit message, for my changes"
# -> Commit message: Implement Model enum and get_edited_prompt()
This powerful feature simplifies the process of managing and understanding data from different sources, making it easier for you to focus on what really matters: improving your projects and applications.
0.8.7
- Config option to change OpenAI completion color in terminal.
- Minor config logic optimization.
You can change color of OpenAI completion by changing DEFAULT_COLOR
in ~/.config/shell_gpt/.sgptrc
or $DEFAULT_COLOR
env, possible options: black, red, green, yellow, blue, magenta, cyan, white, bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white.
...
DEFAULT_COLOR=magenta
0.8.6
0.8.5
0.8.3
New awesome REPL mode for chat sessions. To start a chat session in REPL mode, use the --repl
option followed by a unique session name. You can also use "temp" as a session name to start a temporary REPL session. Note that --chat
and --repl
are using same chat sessions, so you can use --chat
to start a chat session and then use --repl
to continue the conversation in REPL mode. REPL mode will also show history of your conversation in the beginning. REPL mode can work with --shell
and --code
options, which makes it very handy for interactive shell commands and code generation.