diversen / shell-gpt-php
Using shell-gpt-php to generate code, system commands, or chat. Easy to extend.
Requires
- php: >=8.1
- diversen/minimal-cli-framework: ^7.0
- diversen/tiny-gpt-client: ^1.0
Requires (Dev)
- phpunit/phpunit: ^10.0
- dev-main
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.1
- v2.2.0
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.81
- v2.0.8
- v2.0.5
- v2.0.4
- v2.0.2
- v2.0.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.1
- v0.2.0
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.0
- v0.0.9
- v0.0.8
- v0.0.7
- v0.0.6
- v0.0.5
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
This package is auto-updated.
Last update: 2024-11-08 00:11:39 UTC
README
cat README.md | shgpt q "Summerize the above README in the style of Shakespeare"
Greeting all, 'tis time to install mine shell-gpt-php. 'Tis a wondrous treasure that can assist with thy questions and commands, thine need only download the latest release, execute thine commands, and away we go! Set thy key for the dilaog, or 'tis time to pipe thy content in and generate shell command with or one line python program. Ask a question, or show token usage from thy last ninety days, 'tis all here! Tis a goodly thing all said, so depart thou now, and enjoy thine shell-gpt-php.
Installation
Download the latest release:
wget https://www.10kilobyte.com/shgpt/shgpt.phar sudo cp -f shgpt.phar /usr/local/bin/shgpt sudo chmod +x /usr/local/bin/shgpt rm shgpt.phar
- You may also build it yourself
- Develop commands
Set key
Set (or change) API key
shgpt key
Create a dialog
shgpt dialog
Or:
shgpt d
Something like ChatGPT (gpt-3.5-turbo model). Meaning that the answer is extrapolated from the previous questions and answers.
You: Say "hello world"
Assistant: Hello world!
You: ...
Some sub commands are available in the dialog mode:
Available commands:
save - Save dialog to file
exec - Execute a command and feed the output to the dialog
exit - Exit the dialog
comm - Show all commands
clear - Clear the dialog and start over
Type a message to ChatGPT. Maybe 'hello world!' You may also use above commands.
All dialogs are auto-saved on exit to the directory ~/.config/shell-gpt-php/data/
Generate a shell command:
Command optimized for shell commands.
shgpt shell "Command to search replace in files recursive in current directory"
# -> find . -type f -exec sed -i 's/search/replace/g' {} \;
shgpt s "command to change origin of a git repo"
# -> git remote set-url origin <new url>
Add the -e flag to execute the command:
shgpt s "Command to search replace in files recursive in current directory" -e
# -> Execute command: find . -type f -exec sed -i 's/search/replace/g' {} \; ? Sure you want to continue? [Y/n]
Generating code:
Command to generate code snippets.
shgpt code "Can you make a simple HTML template?" > index.html
more index.html
shgpt c "Write a one line hello world python program"
# -> print("Hello World!")
Ask any question
shgpt question "Extract directories from this list of files: $(ls -l)"
# -> bin, src, tests, vendor
shgpt q "What is the distance to the sun? Just show me the number."
# -> 149,597,870.7 kilometers
STDIN
The shell, code, question
commands will accept input from STDIN. STDIN will be added before the prompt. E.g.:
cat composer.json | shgpt q "What type of input is this?"
# -> This is a PHP package composer JSON file.
Set params
Save some model parameters that will override default params. But not parameters that exists on the command line.
E.g. if you set the temperature to 2.0 you will get kind of crazy results
shgpt params -h
Show token usage
Last 24 hours, last 7 days, last 30 days and last 90 days.
shgpt usage
Export
Export all dialogs as markdown:
shgpt export some_dir
License
MIT © Dennis Iversen