feat: uclaude_install.sh — one-line installer с sparse checkout

- uclaude_install.sh: clone --depth 1 --no-checkout + sparse-checkout (только latest cli.js)
- uclaude_update.sh: обновляет sparse-checkout при смене версии
- README: инструкция с curl one-liner и ручным sparse clone

Клиент скачивает ~12MB (одна версия cli.js), а не все версии.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-02-21 11:43:42 +00:00
parent 3bc69d4eff
commit 18ec457c0d
3 changed files with 79 additions and 9 deletions

View File

@@ -10,15 +10,19 @@ Patched Claude Code CLI for use with custom API endpoints. Automatic updater inc
# 1. Install Claude Code (if not installed)
npm install -g @anthropic-ai/claude-code
# 2. Clone this repo (shallow clone — only latest commit, ~12MB)
git clone --depth 1 https://git.sensey24.ru/aibot777/unlimitedcoding.git
# 2. Clone and install (one command — downloads only latest version)
bash <(curl -s https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/uclaude_install.sh)
# Or manually:
git clone --depth 1 --no-checkout https://git.sensey24.ru/aibot777/unlimitedcoding.git
cd unlimitedcoding
# Note: The updater automatically configures sparse checkout to download
# only the latest release, not all historical versions.
# 3. Run updater (installs patched cli.js + configures settings)
sudo bash uclaude_update.sh
git sparse-checkout set '/*' 'claude/releases/index.json'
git checkout
# Read latest version from index, then checkout only that version:
VER=$(python3 -c "import json; print(json.load(open('claude/releases/index.json'))['latest'])")
git sparse-checkout add "claude/releases/v${VER}"
git checkout
sudo python3 uclaude_updater.py --force
```
### Update

57
uclaude_install.sh Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
# UClaude — one-line installer
# Usage: bash <(curl -s https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/uclaude_install.sh)
# Or: curl -s URL | bash
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; }
command -v node >/dev/null 2>&1 || { echo "ERROR: node not found. Install Node.js 18+ first."; exit 1; }
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 files + index.json only (first pass)
git sparse-checkout init --no-cone
git sparse-checkout set '/*' 'claude/releases/index.json'
git checkout 2>/dev/null
# Now read latest version from index.json and add 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 uclaude_updater.py --force
else
echo " Root privileges required to install cli.js."
sudo python3 uclaude_updater.py --force
fi
echo ""
echo "=== Installation complete ==="
echo " To update later: cd $INSTALL_DIR && sudo bash uclaude_update.sh"

View File

@@ -6,9 +6,18 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# Fetch latest (shallow — only latest commit, minimal download)
# Fetch latest commit (shallow — no history)
git fetch --depth 1 origin master 2>/dev/null && git reset --hard origin/master 2>/dev/null || git pull --quiet 2>/dev/null || true
# Update sparse checkout to include latest version directory
if [ -f claude/releases/index.json ] && git config core.sparseCheckout 2>/dev/null | grep -q true; then
VER=$(python3 -c "import json; print(json.load(open('claude/releases/index.json'))['latest'])" 2>/dev/null)
if [ -n "$VER" ]; then
git sparse-checkout add "claude/releases/v${VER}" 2>/dev/null
git checkout 2>/dev/null || true
fi
fi
# Run updater
if [ "$(id -u)" -eq 0 ]; then
python3 uclaude_updater.py "$@"