#!/bin/bash # UClaude — one-line installer # Usage: bash <(curl -s https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/claude/uclaude_install.sh) set -e REPO_URL="https://git.sensey24.ru/aibot777/unlimitedcoding.git" INSTALL_DIR="${UCLAUDE_DIR:-$HOME/unlimitedcoding}" echo "=== UClaude Installer ===" echo " Install dir: $INSTALL_DIR" # Check prerequisites command -v git >/dev/null 2>&1 || { echo "ERROR: git not found. Install git first."; exit 1; } command -v python3 >/dev/null 2>&1 || { echo "ERROR: python3 not found. Install Python 3 first."; exit 1; } # Node.js check — will be auto-installed by updater if needed command -v node >/dev/null 2>&1 || echo "WARNING: node not found. Updater will attempt auto-install." if [ -d "$INSTALL_DIR/.git" ]; then echo " Already cloned, updating..." cd "$INSTALL_DIR" git fetch --depth 1 origin master 2>/dev/null git reset --hard origin/master 2>/dev/null else echo " Cloning (shallow, sparse — only latest version)..." # Shallow clone without checkout git clone --depth 1 --no-checkout "$REPO_URL" "$INSTALL_DIR" cd "$INSTALL_DIR" # Enable sparse checkout: root + claude core files + index.json (first pass) git sparse-checkout init --no-cone git sparse-checkout set '/*' 'claude/*' '!claude/releases/v*' 'claude/releases/index.json' git checkout 2>/dev/null # Read latest version from index.json and add only that release dir if [ -f claude/releases/index.json ]; then VER=$(python3 -c "import json; print(json.load(open('claude/releases/index.json'))['latest'])") echo " Latest version: v${VER}" git sparse-checkout add "claude/releases/v${VER}" git checkout 2>/dev/null fi fi echo "" echo " Running updater..." # Run updater (needs root for cli.js replacement) if [ "$(id -u)" -eq 0 ]; then python3 claude/uclaude_updater.py --force else echo " Root privileges required to install cli.js." sudo python3 claude/uclaude_updater.py --force fi echo "" echo "=== Installation complete ===" echo " To update later: cd $INSTALL_DIR && sudo bash claude/uclaude_update.sh"