|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Exit immediately on error, treat unset variables as an error, and fail if any command in a pipeline fails. |
| 4 | +set -euo pipefail |
| 5 | + |
| 6 | +# Function to run a command and show logs only on error |
| 7 | +run_command() { |
| 8 | + local command_to_run="$*" |
| 9 | + local output |
| 10 | + local exit_code |
| 11 | + |
| 12 | + # Capture all output (stdout and stderr) |
| 13 | + output=$(eval "$command_to_run" 2>&1) || exit_code=$? |
| 14 | + exit_code=${exit_code:-0} |
| 15 | + |
| 16 | + if [ $exit_code -ne 0 ]; then |
| 17 | + echo -e "\033[0;31m[ERROR] Command failed (Exit Code $exit_code): $command_to_run\033[0m" >&2 |
| 18 | + echo -e "\033[0;31m$output\033[0m" >&2 |
| 19 | + |
| 20 | + return $exit_code |
| 21 | + fi |
| 22 | +} |
| 23 | + |
| 24 | +# Note: We use Bun (instead of npm) as our package manager for its speed and overall efficiency |
| 25 | +# It is a drop-in replacement for Node.js, so we can install npm packages through it without issues |
| 26 | +echo "📦 Installing Bun Package Manager..." |
| 27 | +run_command "curl -fsSL https://bun.sh/install | bash" |
| 28 | +run_command "source ~/.bashrc" |
| 29 | +echo "✅ Done" |
| 30 | + |
| 31 | +export BUN_INSTALL="$HOME/.bun" |
| 32 | +export PATH="$BUN_INSTALL/bin:$PATH" |
| 33 | + |
| 34 | +# Installing CLI-based AI Agents |
| 35 | + |
| 36 | +echo -e "\n🤖 Installing Copilot CLI..." |
| 37 | +run_command "bun add --global @github/copilot@latest" |
| 38 | +echo "✅ Done" |
| 39 | + |
| 40 | +echo -e "\n🤖 Installing Claude CLI..." |
| 41 | +run_command "bun add --global @anthropic-ai/claude-code@latest" |
| 42 | +echo "✅ Done" |
| 43 | + |
| 44 | +echo -e "\n🤖 Installing Codex CLI..." |
| 45 | +run_command "bun add --global @openai/codex@latest" |
| 46 | +echo "✅ Done" |
| 47 | + |
| 48 | +echo -e "\n🤖 Installing Gemini CLI..." |
| 49 | +run_command "bun add --global @google/gemini-cli@latest" |
| 50 | +echo "✅ Done" |
| 51 | + |
| 52 | +echo -e "\n🤖 Installing Augie CLI..." |
| 53 | +run_command "bun add --global @augmentcode/auggie@latest" |
| 54 | +echo "✅ Done" |
| 55 | + |
| 56 | +echo -e "\n🤖 Installing Qwen Code CLI..." |
| 57 | +run_command "bun add --global @qwen-code/qwen-code@latest" |
| 58 | +echo "✅ Done" |
| 59 | + |
| 60 | +echo -e "\n🤖 Installing OpenCode CLI..." |
| 61 | +run_command "bun add --global opencode-ai@latest" |
| 62 | +echo "✅ Done" |
| 63 | + |
| 64 | +echo -e "\n🤖 Installing Amazon Developer Q CLI..." |
| 65 | +run_command "curl --proto '=https' --tlsv1.2 -sSf \"https://desktop-release.q.us-east-1.amazonaws.com/latest/q-x86_64-linux.zip\" -o \"q.zip\"" |
| 66 | +run_command "unzip q.zip && rm q.zip" |
| 67 | +run_command "./q/install.sh --no-confirm" |
| 68 | +run_command "rm -rf ./q" |
| 69 | +echo "✅ Done" |
| 70 | + |
| 71 | +# Installing UV (Python package manager) |
| 72 | +echo -e "\n🐍 Installing UV - Python Package Manager..." |
| 73 | +run_command "pipx install uv" |
| 74 | +echo "✅ Done" |
| 75 | + |
| 76 | +# Installing DocFx (for documentation site) |
| 77 | +echo -e "\n📚 Installing DocFx..." |
| 78 | +run_command "dotnet tool update -g docfx" |
| 79 | +echo "✅ Done" |
| 80 | + |
| 81 | +echo -e "\n🧹 Cleaning cache..." |
| 82 | +run_command "sudo apt-get autoclean" |
| 83 | +run_command "sudo apt-get clean" |
| 84 | + |
| 85 | +echo "✅ Setup completed. Happy coding! 🚀" |
0 commit comments