Package: comai
The AI powered terminal assistantWhat is comai? 🎯comaiis an open source terminal assistant powered by OpenAI API that enables you to interact with your command line interface using natural language instructions. It simplifies your workflow by converting natural language queries into executable commands. No more memorizing complex syntax. Just chat withcomaiusing plain English!Installation 🚀Gettingcomaiup and running is a breeze. You can simply usepipto install the latest version:pipinstallcomaiHowever, if you usually work with python environments, it is recommended to usepipxinstead:pipxinstallcomaiThe first time you run it, it'll ask you for an OpenAI API key. You can create a developer accounthere. Once in your account, go toAPI Keyssection andCreate new secret key. We recommend setting a usage limit underBilling/Usage limits.NOTE:comaiuses the environment variableTERM_SESSION_IDto maintain context between calls so you don't need to repeat yourself giving instructions to it. You can check if it is available in your default terminal checking the output ofecho $TERM_SESSION_ID, which should return some type of UUID. If the output is empty, you can simply add the following to your.zshrc/.bashrcfile:exportTERM_SESSION_ID=$(uuidgen)Usage Examples 🎉Usingcomaiis straightforward. Simply invoke thecomaicommand followed by your natural language instruction.comaiwill provide you with the corresponding executable command, which you can execute by pressing Enter or ignore by pressing any other key.Let's dive into some exciting examples of how you can harness the power ofcomai:Manage your system like a pro:$comaiprintmyprivateipaddress
❯ifconfig|grep"inet "|grep-v127.0.0.1|awk'{print $2}'192.168.0.2

$comaiandmypublicone
❯curlifconfig.me92.234.58.146Master the intricacies ofgit:$comaisquashthelast3commitsintoasinglecommit
❯gitrebase-iHEAD~3

$comaishowmeallthebrancheshavingcommitc4c0d2dincommon
❯gitbranch--containsc4c0d2dchat-apiconfigparser
*mainCheck the weather forecast for your location:$comaishowmetheweatherforecast
❯curlwttr.inFind the annoying process using the port 8080:$comaishowmetheprocessusingtheport8080❯lsof-i:8080
COMMANDPIDUSERFDTYPEDEVICESIZE/OFFNODENAME
node36350pedrorico18uIPv40xe0d28ea918e376b0t0TCP*:http-alt(LISTEN)$comaishowmeonlythePID
❯lsof-t-i:808036350$comaikillit
❯kill$(lsof-t-i:8080)Swiftly get rid of all your docker containers:$comaistopandremoveallrunningdockercontainers
❯dockerstop$(dockerps-aq)&&dockerrm$(dockerps-aq)These are just a few examples of howcomaican help you harness the power of the command line and provide you with useful and entertaining commands. Feel free to explore and experiment with the commands generated bycomaito discover more exciting possibilities!Contributions welcome! 🤝If you're interested in joining the development of new features forcomai, here's all you need to get started:Clone therepositoryand navigate to the root folder.Install the package in editable mode by runningpip install -e ..Run the tests usingpytest. Make sure you have theOPENAI_API_KEYenvironment variable set up with your OpenAI API key. Alternatively, you can create a file named.envand define the variable there.This project utilizes black for code formatting. To ensure your changes adhere to this format, simply follow these steps:pipinstallblack
black.For users of VS Code, you can configure the following options after installingblack:"editor.formatOnSave":true,"python.formatting.provider":"black"License 📜Comai is licensed under the GPLv3. You can find the full text of the license in theLICENSEfile.