Package: clipea-cli
Clipea 📎🟢Like Clippy but for the CLI. A blazing fast AI helper for your command line.Clipea is a streamlined, cheap and hackable tool that integrates GPT with your console.
It's like Github'sCopilot for CLIbut it's cheaper, faster and doesn't get in your way.Tell Clipea what you want to do and it'll give you a shell command, asking you if you want to run it. Clipea works even better with Zsh, as it adds the shell command to your console as a pending command, just as if you had typed it yourself!Clipea was born out ofHubcap, an experimental autonomous agent.
Clipea is less dangerous and actually designed to be a usable productivity tool, rather than just a tech demo.Advantages over copying and pasting from ChatGPT:Speed. No need to switch to your browser and backShell integration, like filename completionAutomatically knows things like your shell and OS[!CAUTION]
AI isn't perfect. Clipea might suggest a dangerous command. Be careful.🚀 Quick Startbrew tap dave1010/clipea
brew install clipea
clipea setup
clipea alias🪄 UsageOnce installed, just ask Clipea for a command:clipea convert test.mp4 to a gifTypey<enter>to run the command. Anything else or<ctrl-c>to cancel.Or, if you have the Zsh integration (highly recommended), it's even easier:?? how many gig free do i haveJust press<enter>to run the command or<backspace>if you want to edit it.Clipea works best when you give it a task to complete, rather than a question: LLMs love explaining things whenever you're not sure.❓❓ Using the Zsh shell integration (recommended)The Zsh integration is more than just a quick alias.
It allows Clipea to put the command in your input buffer, ready to run, just as if you'd typed it yourself.# setup
clipea alias

# usage
?? how many gig free do i haveBenefits:Quicker to typeShows up in your shell historyAllows editing with normal shell commands like<ctrl-c>to cancel or<ctrl-a>to go to the start of the lineRuns the command as a child process of your shell, rather than a child of ClipeaBehind the scenes this is using zsh'sprint -z.🧙 Advanced usage and tipsGPT-4 modeJust start the query with a "4". Remember that OpenAI charge lots more for GPT-4.
Generally the standard GPT-3.5 is fine for commandline stuff.?? 4 create a text file explaining quantum mechanics in a haiku in the style of a pirateGetting data from stdinYou can also send in data via stdin. Clipea limits you to 8192 bytes, so the LLM isn't overwhelmed.ls -F | ?? explain this project setupMost of the time it's best to give Clipea a filename to create a command for, rather than the actual file contents.cat package.json | ?? how many packages here     # GPT isn't great at counting
?? count how many packages are in package.json   # GPT is good at suggesting commandsEnvironmentClipea gets given some environment limited information like your OS, shell and path.
This allows it to give better responses.?? wheres my shell config
?? install curl
?? compare README.md to my clipboardCustom PromptYou can customize your prompt by creating a prompt file in your home directory.~/.config/clipea/system-prompt.txtYou might wanna start by copying the default prompt:cp $(dirname $(readlink -f $(which clipea)))/system-prompt.txt ~/.config/clipea/system-prompt.txtThen edit~/.config/clipea/system-prompt.txtto your liking, but be aware that environment info is always added to the end of the prompt.⤴️ Feedback and editingJust use your shell history by pressing the<up>arrow key. Your cursor will be at the end of
the last line, ready to edit it.For example: typing?? list js files recursivelymay give$ find . -name "*.js"Then to edit, press<up>thenignore node modulesto get something like$ find . -name "*.js" -not -path "./node_modules/*"Clipea doesn't have any context of what it said before, though this may be added in the future if there's use cases it helps with.More examplesSystem Operations?? open my shell login script in my editor
?? Extract package.tar.gz
?? Install something that converts pdf to text
?? Make a 30 char passwordFile Operations?? Find files bigger than 10mb
?? Rename all txt files space to underscore
?? Convert file.avi to gif
?? Decrypt data.txt.gpgText Files and Coding?? Highlight URLs in index.html
?? Show me just the headings from README.md
?? count loc recursively
?? Find replace all PHP files in project that call eval function with safe_eval
?? git fetch, rebase master, safely force push
?? turn orders.csv into sqlite
?? count payments in orders.dbWeb and Network Tasks?? open bbc news
?? check the spf record for example.com
?? What port is my webserver listening on
?? Check cors headers for api.example.com
?? Where is nginx writing logs
?? Quick http server📦 Installation and setupManual installationPython >=3.10 is required.You can use the providedsetup.py. (setuptools docs)You can install it quickly like so:python3 setup.py sdist
pip install dist/clipea-{version}.tar.gzOr development mode:pip install -e .With PyPi (soon)#pip install clipeaZsh Shell integration and Alias[!TIP]
The??shell alias is highly recommended if you use zshclipea aliasInternalsClipea is written in Python (3.10+).Clipea usesllmto interact with large language models.By default it will use OpenAI's GPT-3.5 model but can be configured to other models, such as Llama.
Runningclipea setupwill talk you through getting OpenAI keys.❗ WarningsSafety[!CAUTION]
Always read and check what Clipea suggests before accepting it.PrivacyClipea uses OpenAI's APIs by default, though can be set to use any LLM thatllmsupports.Only very basic environment info like your OS and editor is sent to the LLM.
Runclipea envto see the data the LLM gets.CostAs a very rough example, using the default GPT-3.5, 100 Clipea queries to OpenAI cost $0.02.
Set a quota and keep an eye on costs to make sure.AcknowledgementsBig thanks to @edouard-sn for the port to Python.ContributingContributions welcome.LicenseMIT LicenseCopyright (c) 2023 Dave Hulbert