diff --git a/claude/uclaude_install.sh b/claude/uclaude_install.sh index ea5b75d..f5d0bfc 100755 --- a/claude/uclaude_install.sh +++ b/claude/uclaude_install.sh @@ -164,7 +164,38 @@ fi echo "" echo "=== Installation complete ===" -echo " To update later: cd $INSTALL_DIR && sudo bash claude/uclaude_update.sh" +echo "" + +# Sanity check what landed in settings.json (helps diagnose "only 5 models +# in /model picker" case — usually means CLAUDE_CUSTOM_MODELS missing +# from settings.json env block). +ME_HOME="${HOME:-/root}" +SETTINGS="$ME_HOME/.claude/settings.json" +if [ -f "$SETTINGS" ]; then + echo " Verification: $SETTINGS" + python3 - "$SETTINGS" <<'PYEOF' +import json, sys +try: + s = json.load(open(sys.argv[1])) + env = s.get("env", {}) + ccm = env.get("CLAUDE_CUSTOM_MODELS", "") + n = len(ccm.split(",")) if ccm else 0 + print(f" base_url: {env.get('ANTHROPIC_BASE_URL','-')}") + auth = env.get("ANTHROPIC_AUTH_TOKEN", "") + print(f" auth_token: {auth[:8]}{'...' if auth else ' (NOT SET — auth will fail!)'}") + print(f" custom_models: {n} models {'⚠ ZERO — /model will show built-ins only' if n==0 else 'OK'}") + if n > 0: + print(f" sample: {','.join(ccm.split(',')[:3])}...") +except Exception as e: + print(f" ERROR reading settings.json: {e}") +PYEOF +else + echo " (no $SETTINGS to verify — patcher may not have run)" +fi + +echo "" +echo " Run claude: claude # interactive" +echo " Update later: cd $INSTALL_DIR && sudo bash claude/uclaude_update.sh" echo "" echo " To install Codex CLI separately, see README codex section:" echo " https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.sh" diff --git a/claude/uclaude_updater.py b/claude/uclaude_updater.py index de3b1fe..78bbb4e 100755 --- a/claude/uclaude_updater.py +++ b/claude/uclaude_updater.py @@ -876,10 +876,31 @@ def patch_all_users(config): eprint(f" {Y}No users found{D}") return + # Diagnostic: confirm config has the key fields BEFORE patching users. + # If models is empty/missing, claude shows only built-in defaults + # (user reported only 5 models in /model picker — root cause was here). + n_models = len(config.get("models", [])) + if n_models == 0: + eprint(f" {R}WARNING: config has 0 models — claude /model will show built-ins only{D}") + else: + print(f" Config has {n_models} models (sample: {','.join(config['models'][:3])}...)") + if not config.get("api_key") or config["api_key"] in ("YOUR_API_KEY", "PLACEHOLDER", ""): + eprint(f" {R}WARNING: api_key is placeholder/empty — claude API auth will fail{D}") + for user in users: try: path = patch_user(user.home, user.name, user.uid, user.gid, config) - print(f" {G}Patched {user.name}{D}: {path}") + # Verify what landed in settings.json + try: + with open(path, "r") as f: + written = json.load(f) + env_block = written.get("env", {}) + ccm = env_block.get("CLAUDE_CUSTOM_MODELS", "") + ccm_count = len(ccm.split(",")) if ccm else 0 + print(f" {G}Patched {user.name}{D}: {path} " + f"(env.CLAUDE_CUSTOM_MODELS={ccm_count} models)") + except Exception: + print(f" {G}Patched {user.name}{D}: {path}") except Exception as e: eprint(f" {R}Failed to patch {user.name}: {e}{D}")