Command Line Genius
🤔 What is CommandLineGenius?
CommandLineGenius is a native macOS command-line tool that bridges the gap between human intent and machine instruction. Instead of struggling to remember the exact syntax for find
, grep
, awk
, or git
commands, you simply describe what you want to do in plain English. The assistant uses a powerful, locally-run AI to generate the precise command and places it directly into your terminal prompt, ready for you to execute.
This project is built on the principle of local-first AI, ensuring your data remains private, your workflow is fast, and you have a powerful assistant even when you're offline.
✨ Features
- Natural Language to Command: Convert complex requests like "find all files larger than 50MB in my downloads folder" into find ~/Downloads -size +50M.
- Multi-Mode Architecture: Use flags like --git to switch the AI's context, providing highly accurate, domain-specific commands for different tools.
- Seamless Shell Integration: The generated command is injected directly into your Zsh or Bash prompt, feeling like a native feature of your terminal.
- 100% Local & Private: Powered by Codellama, all AI processing happens on your machine. No data ever leaves your computer.
- Blazingly Fast: Built in native Swift for optimal performance on macOS.
🚀 Setting Up
- Install Homebrew
- Brew Install Ollama
- Pull Codellama 7b or 13b using Ollama
- Download the tool
- Copy the Provided Tool Into Below Folder
~/usr/local/bin/
- Integrate with shell
- Start Using CommandLineGenius
Integrating with Your Shell
To enable the AI command, you need to add a small function to your shell's configuration file.
For Zsh users (default on modern macOS):
- Open your Zsh configuration file: open ~/.zshrc
- Add the following function to the end of the file:
# CommandLineGenius AI() { local cmd cmd=$(CommandLineGenius "$@") if [[ -n "$cmd" ]]; then print -z -- "$cmd" fi }
- Restart your terminal or run source ~/.zshrc. That's it!
For Bash users:
- Open your Bash configuration file: open ~/.bash_profile
- Add the following function to the end of the file:
AI() { local cmd cmd=$(CommandLineGenius "$@") if [[ -n "$cmd" ]]; then READLINE_LINE="$cmd" READLINE_POINT=${#cmd} fi }
- Restart your terminal or run source ~/.bash_profile.
You're all set! Try it out:
AI --git "revert the last commit"