From c3f04dee65e163347c3c5bd132a02cc2b7566d44 Mon Sep 17 00:00:00 2001 From: Peter Wood Date: Tue, 1 Jul 2025 13:33:16 -0400 Subject: [PATCH] added google gemini cli to the setup process. github.com/google-gemini/gemini-cli --- dotfiles/README.md | 133 ++++++++++++++++++++++++++++++- dotfiles/my-aliases.zsh.original | 4 + google-gemini-setup.sh | 34 -------- setup/setup.sh | 26 ++++++ 4 files changed, 160 insertions(+), 37 deletions(-) delete mode 100755 google-gemini-setup.sh diff --git a/dotfiles/README.md b/dotfiles/README.md index 50613ab..262607d 100644 --- a/dotfiles/README.md +++ b/dotfiles/README.md @@ -1,4 +1,3 @@ - # dotfiles My personal dotfiles and system setup configuration for Linux machines. @@ -129,9 +128,137 @@ The tests validate: For more details on testing, see [Docker Bootstrap Testing Framework](../docs/docker-bootstrap-testing-framework.md). -## Manual Steps +## Creating New Aliases -If you need to manually set up aliases: +The system supports two types of aliases: **static aliases** (always available) and **dynamic aliases** (conditional based on installed tools). + +### Static Aliases (Simple Commands) + +For simple command shortcuts that don't require conditional logic: + +1. **Edit the base aliases file**: + ```bash + nano ~/shell/dotfiles/my-aliases.zsh.original + ``` + +2. **Add your alias** in the appropriate section: + ```bash + # Example: Add a new Git alias + alias gst="git status" + + # Example: Add a system alias + alias ll="ls -la" + ``` + +3. **Run the setup script** to regenerate aliases: + ```bash + ~/shell/setup/setup.sh + ``` + +4. **Reload your shell**: + ```bash + source ~/.zshrc + ``` + +### Dynamic Aliases (Conditional) + +For aliases that depend on whether a tool is installed: + +1. **Edit the setup script**: + ```bash + nano ~/shell/setup/setup.sh + ``` + +2. **Add your conditional alias** after the existing alias setup sections (around line 560): + ```bash + # Set up your-tool alias if your-tool is available + if command -v your-tool &> /dev/null; then + echo -e "${YELLOW}Setting up your-tool alias...${NC}" + echo "alias yt=\"your-tool\"" >> "$ALIASES_FILE" + echo -e "${GREEN}Your-tool alias (yt) configured successfully!${NC}" + else + echo -e "${YELLOW}Your-tool not found. Skipping yt alias.${NC}" + fi + ``` + +3. **Run the setup script**: + ```bash + ~/shell/setup/setup.sh + ``` + +### Alias Categories and Examples + +#### 🔧 System Management +```bash +alias update="/home/acedanger/shell/update.sh" +alias ll="ls -laFh --group-directories-first --color=auto" +``` + +#### 🐳 Docker & Containers +```bash +alias dcdn="docker compose down" +alias dcupd="docker compose up -d" +alias lzd="lazydocker" +alias lzg="lazygit" # Recently added +``` + +#### 🎬 Media & Services +```bash +alias plex="/home/acedanger/shell/plex/plex.sh" +alias px="/home/acedanger/shell/plex/plex.sh" +``` + +#### 🔧 Development Tools +```bash +alias py="python3" +alias gc="git commit" +alias gcm="git commit -m" +``` + +### Alias Organization Best Practices + +1. **Use meaningful names**: Choose alias names that are intuitive and memorable + - `lzg` for lazygit ✅ + - `x` for some obscure command ❌ + +2. **Group related aliases**: Keep similar functionality together + - Docker commands: `dcdn`, `dcupd`, `lzd` + - Git commands: `gc`, `gcm`, `gpull`, `gpush` + +3. **Use emojis for sections**: Help organize and visualize alias categories + ```bash + # 🐳 Docker Compose Shortcuts + # 🎬 Plex Media Server Management + # 🔧 System Management + ``` + +4. **Test before committing**: Always test new aliases to ensure they work correctly + +5. **Document complex aliases**: Add comments for non-obvious functionality + ```bash + # Opens Plex web interface in default browser + alias plex-web="xdg-open http://localhost:32400/web" + ``` + +### Troubleshooting Aliases + +**Alias not working after setup?** +- Restart your terminal or run `source ~/.zshrc` +- Check if the command exists: `which command-name` +- Verify alias was created: `alias alias-name` + +**Alias conflicts?** +- Check for existing aliases: `alias | grep alias-name` +- Use `unalias alias-name` to remove conflicting aliases + +**Want to remove an alias?** +1. Edit the source file (`my-aliases.zsh.original` or `setup.sh`) +2. Run the setup script again +3. Reload your shell + +## Manual Symlink Setup + +If you need to manually set up the aliases symlink: ```sh # Create new symlink diff --git a/dotfiles/my-aliases.zsh.original b/dotfiles/my-aliases.zsh.original index cbddc97..e6cdb15 100644 --- a/dotfiles/my-aliases.zsh.original +++ b/dotfiles/my-aliases.zsh.original @@ -26,6 +26,10 @@ alias backup-manager="/home/acedanger/shell/backup-tui" # 🔧 System Management alias update="/home/acedanger/shell/update.sh" +# 🤖 AI & Development Tools +alias gm="gemini" +alias gemini-cli="gemini" + # Note: The following aliases are dynamically generated by setup.sh based on available commands: # - cat/bat aliases (batcat vs bat) # - fd aliases (fdfind vs fd) diff --git a/google-gemini-setup.sh b/google-gemini-setup.sh deleted file mode 100755 index c62da3c..0000000 --- a/google-gemini-setup.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -e # Exit on any error - -# Colors for output -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -RED='\033[0;31m' -NC='\033[0m' # No Color - -# Check if gemini is installed -if ! command -v gemini &> /dev/null; then - echo -e "${YELLOW}gemini-cli not found, installing...${NC}" - - # Check if npm is available - if ! command -v npm &> /dev/null; then - echo -e "${RED}Error: npm is not installed. Please install Node.js and npm first.${NC}" - exit 1 - fi - - # Install gemini-cli globally - if npm install -g @google/gemini-cli; then - echo -e "${GREEN}gemini-cli installed successfully!${NC}" - else - echo -e "${RED}Error: Failed to install gemini-cli${NC}" - exit 1 - fi -else - echo -e "${GREEN}gemini-cli is already installed${NC}" -fi - -# Always execute gemini CLI after ensuring it's installed -echo -e "${YELLOW}Launching gemini-cli...${NC}" -gemini "$@" diff --git a/setup/setup.sh b/setup/setup.sh index 5c3a446..e0a9e60 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -413,8 +413,24 @@ if command -v nvm &>/dev/null; then nvm use --lts # Set the LTS version as default nvm alias default 'lts/*' + + # Install global npm packages after Node.js is set up + echo -e "${YELLOW}Installing global npm packages...${NC}" + + # Install Google Gemini CLI + if ! command -v gemini &> /dev/null; then + echo -e "${YELLOW}Installing Google Gemini CLI...${NC}" + if npm install -g @google/gemini-cli; then + echo -e "${GREEN}Google Gemini CLI installed successfully!${NC}" + else + echo -e "${RED}Warning: Failed to install Google Gemini CLI${NC}" + fi + else + echo -e "${GREEN}Google Gemini CLI is already installed${NC}" + fi else echo -e "${YELLOW}Warning: nvm installation may require a new shell session${NC}" + echo -e "${YELLOW}Warning: Skipping npm package installations (npm not available)${NC}" fi # Define a reusable function for cloning Zsh plugins @@ -575,6 +591,16 @@ alias ll="ls -laFh --group-directories-first --color=auto" EOF fi +# Set up gemini CLI alias if gemini is available +if command -v gemini &> /dev/null; then + echo -e "${YELLOW}Setting up gemini CLI aliases...${NC}" + echo "alias gm=\"gemini\"" >> "$ALIASES_FILE" + echo "alias gemini-cli=\"gemini\"" >> "$ALIASES_FILE" + echo -e "${GREEN}Gemini CLI aliases (gm, gemini-cli) configured successfully!${NC}" +else + echo -e "${YELLOW}Gemini CLI not found. Skipping gemini aliases.${NC}" +fi + # Save the customized aliases to the dotfiles directory for reference echo -e "${YELLOW}Saving customized aliases to dotfiles directory...${NC}" if [ -f "$ALIASES_FILE" ]; then