A Go CLI utility that uses the Anthropic Claude API to generate shell commands based on natural language descriptions.
A Go CLI utility that uses the Anthropic Claude API to generate shell commands based on natural language descriptions. Built with Bubble Tea for an interactive terminal user interface.
If you don't have Go installed, you can install it using Homebrew:
brew install go
go install github.com/benmyles/clippycli@latest
git clone https://github.com/benmyles/clippycli.git
cd clippycli
go build -o clippycli
Set your Anthropic API key as an environment variable:
export ANTHROPIC_API_KEY="your_api_key_here"
You can add this to your shell profile (.bashrc
, .zshrc
, etc.) to make it permanent:
echo 'export ANTHROPIC_API_KEY="your_api_key_here"' >> ~/.zshrc
source ~/.zshrc
For even more convenient usage, you can create a shell alias. This is especially useful if you prefer not to set the API key globally or want a shorter command:
alias cc="ANTHROPIC_API_KEY=YOUR_API_KEY clippycli"
Replace YOUR_API_KEY
with your actual Anthropic API key. Add this to your shell profile to make it permanent:
echo 'alias cc="ANTHROPIC_API_KEY=your_api_key_here clippycli"' >> ~/.zshrc
source ~/.zshrc
Now you can use ClippyCLI with just:
cc "list all files"
cc "find large files over 100MB"
cc -v "show memory usage"
This approach allows you to:
cc
)Simply run the utility:
./clippycli
Or if installed globally:
clippycli
You can also pass your prompt as a command-line argument to automatically generate a command:
./clippycli "list all files in current directory"
clippycli "find large files over 100MB"
When you provide a prompt as an argument, ClippyCLI will immediately start generating the command and show you the result for review. This is especially useful for quick commands where you want to skip the input step.
Use the -v
flag to see the full prompt that was sent to the AI, including system instructions and environment information:
clippycli -v "find large files"
This is helpful for understanding exactly what context ClippyCLI provides to the AI and for debugging or learning purposes.
To see usage information and examples:
clippycli --help
# or
clippycli -h
-v
: Verbose mode - Shows the full prompt sent to the AI, including system instructions and environment context-h, --help
: Shows help information and usage examplesStarting with no arguments:
π§ ClippyCLI - AI Command Generator
What would you like to do?
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β find all python files and count lines of code β
β β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Press Enter to generate command β’ Ctrl+C/Esc to quit
Starting with auto-generation:
./clippycli "find all python files and count lines of code"
π§ ClippyCLI - AI Command Generator
Generating command for:
"find all python files and count lines of code"
β Thinking...
Then immediately shows the result:
π§ ClippyCLI - AI Command Generator
Generated command:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β find . -name "*.py" -exec wc -l {} + | tail -1 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Press Enter to copy to clipboard β’ E to edit prompt β’ Any other key to cancel
In both modes, after pressing Enter:
π§ ClippyCLI - AI Command Generator
Generated command:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β find . -name "*.py" -exec wc -l {} + | tail -1 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Press Enter to copy to clipboard β’ E to edit prompt β’ Any other key to cancel
When you press Enter to copy to clipboard, the TUI closes and you'll see:
β Command copied to clipboard:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β find . -name "*.py" -exec wc -l {} + | tail -1 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Paste with Ctrl+V (or Cmd+V on macOS)
You can then paste and execute the command in your terminal.
ClippyCLI automatically detects and uses your environment information to generate more appropriate commands:
This means ClippyCLI can generate commands that:
ClippyCLI includes several safety measures:
Here are some example prompts and the types of commands ClippyCLI might generate:
Prompt | Generated Command |
---|---|
"list all files" | ls -la |
"find large files" | find . -type f -size +100M -ls |
"count lines in go files" | find . -name "*.go" -exec wc -l {} + | tail -1 |
"create project directory" | mkdir myproject |
"show disk usage" | df -h |
"find recent files" | find . -type f -mtime -1 |
# Quick file listing
clippycli "list all files"
# Find specific file types
clippycli "find all .txt files in subdirectories"
# System information
clippycli "show memory usage"
# File operations
clippycli "create a backup of config.json"
# Process management
clippycli "show running processes using port 8080"
# Verbose mode to see full AI prompt
clippycli -v "find large files over 100MB"
If ClippyCLI encounters an error:
clippycli/
βββ main.go # Main application logic
βββ go.mod # Go module definition
βββ go.sum # Dependency checksums
βββ README.md # This file
go build -o clippycli
go test ./...
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
β οΈ Disclaimer: Always review generated commands before execution. While ClippyCLI includes safety measures, you are responsible for the commands you choose to run on your system.