diff --git a/claude/uclaude_install.sh b/claude/uclaude_install.sh index 670e704..45bd973 100755 --- a/claude/uclaude_install.sh +++ b/claude/uclaude_install.sh @@ -111,6 +111,12 @@ git reset --hard origin/master 2>/dev/null || git pull --quiet 2>/dev/null echo " Running updater..." +# Configure npm registry for @anthropic-ai scope before running updater +if command -v npm >/dev/null 2>&1; then + echo " Configuring npm registry: https://npm.sensey24.ru/" + npm config set "@anthropic-ai:registry" "https://npm.sensey24.ru/" 2>/dev/null || true +fi + # Run updater (needs root for cli.js replacement + node install) if [ "$(id -u)" -eq 0 ]; then python3 claude/uclaude_updater.py --force diff --git a/claude/uclaude_updater.py b/claude/uclaude_updater.py index 3182926..d558fa4 100644 --- a/claude/uclaude_updater.py +++ b/claude/uclaude_updater.py @@ -242,6 +242,20 @@ def ensure_node(): # Claude Code auto-install # ============================================================ +NPM_REGISTRY = "https://npm.sensey24.ru/" + + +def set_npm_registry(): + """Configure npm to use our patched registry for @anthropic-ai scope.""" + try: + run_cmd( + ["npm", "config", "set", "@anthropic-ai:registry", NPM_REGISTRY], + capture_output=True, text=True, timeout=10, + ) + except Exception: + pass + + def ensure_claude_code(target_version=None): """Install or update Claude Code via npm. Returns True if OK. @@ -266,9 +280,13 @@ def ensure_claude_code(target_version=None): print(f" {Y}Claude Code not found. Installing via npm...{D}") pkg = "@anthropic-ai/claude-code" + (f"@{target_version}" if target_version else "") + # Configure registry for @anthropic-ai scope + set_npm_registry() + print(f" Using registry: {NPM_REGISTRY}") + try: result = run_cmd( - ["npm", "install", "-g", pkg], + ["npm", "install", "-g", pkg, "--registry", NPM_REGISTRY], capture_output=True, text=True, timeout=300, ) if result.returncode == 0: