A CLI tool that runs shell scripts based on natural language descriptions
To install ShExec, run the following commands:
cd ~/Downloads
wget https://github.com/YassineLafryhi/ShExec/releases/download/1.0.0/ShExec-1.0.0-macOS-Universal.zip
unzip ShExec-1.0.0-macOS-Universal.zip
sudo mkdir -p /usr/local/bin
sudo mv shexec /usr/local/bin/shexec
sudo chmod +x /usr/local/bin/shexec
cd ~/Downloads
wget https://github.com/YassineLafryhi/ShExec/releases/download/1.0.0/ShExec-1.0.0-linux-x86_64.zip
unzip ShExec-1.0.0-linux-x86_64.zip
sudo mkdir -p /usr/local/bin
sudo mv shexec /usr/local/bin/shexec
sudo chmod +x /usr/local/bin/shexec
Note
Currently, ShExec
uses the following models: Gemini 1.0 Pro
, Claude-3-opus-20240229
and llama2
via Ollama (https://github.com/ollama/ollama), other models will be supported very soon !
To use the shexec
, ensure you have a valid API KEY of the model you want to use (or Ollama installed if you prefer to work locally), then initiate the command alongside a textual description of your intended task. For example:
cd ~/Desktop && mkdir ShExecTest && cd ShExecTest
wget -O photo.jpg https://images.unsplash.com/photo-1512486130939-2c4f79935e4f
shexec "Convert the image photo.jpg to png"
Upon initial use, you will be prompted to enter your model's API Key, then it will be saved to ~/.shexec.yml config file for future uses.
Upon successful generation of the Shell script, it will be opened in a new terminal window. You will then be prompted to proceed with execution or abort the process. Press the 'r' key to execute the script, or any other key to abort.
Warning
It is strongly advisable to carefully review the generated shell script prior to execution to ensure it accurately fulfills your requirements.
cd ~/Desktop/ShExecTest
touch Doc128_old.pdf
touch Doc123_old.pdf
shexec "Remove all PDF files that have a name starting with 'Doc' then an even index then end with '_old' (like: Doc124_old.pdf)"
cd ~/Desktop/ShExecTest
shexec "قم بإعداد صفحة ويب تحتوي على ثلاث فقرات عن موضوع الحواسيب الكمومية بالعربية ثم قم بحفظها باسم الحواسيب_الكمومية، استعمل خطا عربيا جيدا من خطوط جوجل و لا تنس إعداد اتجاه النص من اليمين لليسار ، بعد ذلك افتحها في متصفح جوجل كروم"
cd ~/Desktop/ShExecTest
shexec "Create a simple Flask API that will use the port 9090 and have one GET route (/api/v1/books) that will read the books (name, author) from a db.json file. Create an initial db.json file with 4 records. Put the code in a file app.py, then run it in the background and open a request example in chrome"
shexec "Holen Sie sich ein schönes Hintergrundbild von Unsplash und richten Sie es dann als Desktop-Hintergrund ein"
To build ShExec from source, run the following commands:
git clone https://github.com/YassineLafryhi/ShExec.git
cd ShExec
chmod +x build.sh
./build.sh
# Then you can move shexec to /usr/local/bin/shexec
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request