#!/usr/bin/env bash # Script to install Jules CLI # Usage: bash scripts/install_jules.sh set -euo pipefail # Colors GREEN='\033[0;32m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' # No Color echo -e "${GREEN}Installing Jules CLI...${NC}" # Check if npm is available if ! command -v npm &> /dev/null; then echo -e "${RED}Error: npm is not installed.${NC}" echo "Please install Node.js and npm first." exit 1 fi # Check if node is available if ! command -v node &> /dev/null; then echo -e "${RED}Error: node is not installed.${NC}" echo "Please install Node.js first." exit 1 fi # Check Node.js version (requires >= 18.0.0) NODE_VERSION=$(node --version | cut -d'v' -f2) MAJOR_VERSION=$(echo "$NODE_VERSION" | cut -d'.' -f1) if [ "$MAJOR_VERSION" -lt 18 ]; then echo -e "${RED}Error: Node.js version 18 or higher is required.${NC}" echo "Current version: $NODE_VERSION" exit 1 fi echo "Node.js version: $NODE_VERSION ✓" # Install Jules CLI globally echo "Installing @google/jules..." if npm install -g @google/jules; then echo -e "${GREEN}✓ Jules CLI npm package installed successfully${NC}" else echo -e "${RED}Error: Failed to install Jules CLI${NC}" exit 1 fi # Check if jules command is available if command -v jules &> /dev/null; then echo -e "${GREEN}✓ Jules command is available in PATH${NC}" echo " Location: $(which jules)" else echo -e "${RED}Error: Jules command not found in PATH${NC}" exit 1 fi echo "" echo -e "${GREEN}Jules CLI installation complete!${NC}" echo "" echo "Next steps:" echo " 1. Authenticate with Google: ${YELLOW}jules login${NC}" echo " 2. Install GitHub App for your organization (see docs/Jules_CLI_setup.md)" echo " 3. Verify setup: ${YELLOW}jules version${NC}" echo "" echo -e "${YELLOW}Note:${NC} First run requires authentication and will download the Jules binary." echo " In CI/CD environments, use JULES_TOKEN for authentication." echo ""