Dumb CLI is a command-line tool that interprets natural language prompts and executes them as shell commands. It can handle multi-step logic, making your workflow easier and more intuitive.
dumb find the name of the .md file and echo count the number of lines that is present in that file. After that divide the number of lines output by 7
Generated command:
md_file=$(find . -name "*.md" -print -quit)
echo "$md_file"
line_count=$(wc -l <"$md_file" | awk '{print $1}')
echo "$line_count"
echo $((line_count / 7))
Do you want to execute this command? (y/N): y
Executing command...
./README.md
154
22
- Run shell commands using natural language descriptions
- Multi-step logic execution
- Command preview and confirmation
- Easy cancellation for safety
- Deno
- Gemini API key (How to create one)
- Clone this repository:
git clone https://github.com/fadedblack/dumb.git cd dumb - Set up git hooks (for development):
git config core.hooksPath .githooks
- Run the installation script:
./install.sh
- The installer will prompt for your Gemini API key and store it in
~/.config/dumb/config.json. - It will compile the Deno project and install the binary to
~/bin. - Adds the installation directory to your PATH if needed.
- The installer will prompt for your Gemini API key and store it in
- Go to Google AI Studio.
- Sign in with your Google account.
- Navigate to the API Keys section.
- Click "Create API Key" and follow the instructions.
- Copy your new API key and keep it safe.
- Configuration is stored in
~/.config/dumb/config.json(permissions: 600) - Contains your Gemini API key and other settings
For a more interactive experience, add this function to your ~/.zshrc:
function dumb() {
if [ $# -eq 0 ]; then
echo "Usage: dumb <your command>"
echo "Example: dumb 'create a branch and change into that branch'"
return 1
fi
local input_string="$*"
local output
local confirm
output=$(dumb-cli "$input_string")
echo "Generated command:"
echo "$output"
echo -n "Do you want to execute this command? (y/N): "
read -q confirm
echo ""
if [[ $confirm == "y" ]]; then
echo "Executing command..."
eval "$output"
else
echo "Command execution cancelled"
fi
}After adding this function:
- Source your
~/.zshrc:source ~/.zshrc - Use it like this: `zsh dumb "create a new branch named feature and switch to it"
Add this enhanced keyboard shortcut to your ~/.zshrc for quick access with
visual feedback:
YELLOW='\033[1;33m'
NC='\033[0m'
_dumb_wrap_and_run() {
if [[ -n "$BUFFER" ]]; then
print ""
echo -e "${YELLOW}Converting to dumb command:${NC} $BUFFER"
zle reset-prompt
eval "dumb $BUFFER"
BUFFER=""
zle reset-prompt
else
BUFFER="dumb "
zle reset-prompt
fi
}
zle -N _dumb_wrap_and_run
bindkey '^[d' _dumb_wrap_and_runFeatures:
- Press Option+D to instantly start a new dumb command
- Convert existing terminal text into a dumb command with visual highlight
- Clear visual feedback when converting text
Usage:
- Empty prompt: Press Option+D to start a new dumb command
- With existing text: Type your command and press Option+D to convert it with visual highlight
To uninstall Dumb CLI, simply run:
./uninstall.shThis will remove the binary and configuration files. Follow any instructions shown after running the script.