diff --git a/README.md b/README.md index f3425ad..1200ae7 100755 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ Patched AI coding tools for use with custom API endpoints. | Folder | Tool | Status | |--------|------|--------| -| [claude/](claude/) | Claude Code | Active (v2.1.71) | -| [codex/](codex/) | OpenAI Codex CLI | **Active (v0.111.0)** | +| [claude/](claude/) | Claude Code | Active (v2.1.112) | +| [codex/](codex/) | OpenAI Codex CLI | **Active (v0.116.0)** | | [gemini/](gemini/) | Gemini CLI | **Active (v0.32.1)** | -| [qwen/](qwen/) | Qwen Code | **Active (v0.11.1)** | +| [qwen/](qwen/) | Qwen Code | **Active (v0.14.5)** | | antigravity/ | Antigravity | Planned | ## Quick Start @@ -163,14 +163,21 @@ Verify: `gemini -p "Hello"` **Alternative — Automatic installer (installs Node.js, CLI, patches, settings):** -Linux / macOS: +**Linux (Debian/Ubuntu/RHEL/Fedora):** ```bash curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.sh \ -o /tmp/ugemini.sh && sudo bash /tmp/ugemini.sh ``` -Windows (PowerShell as Administrator): +**macOS (Intel & Apple Silicon):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.sh \ + -o /tmp/ugemini.sh && sudo bash /tmp/ugemini.sh +``` + +**Windows (PowerShell as Administrator):** ```powershell $h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} Set-ExecutionPolicy Bypass -Scope Process -Force @@ -178,19 +185,35 @@ iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/u . "$env:TEMP\ugemini_install.ps1" ``` +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.ps1' -OutFile \"$env:TEMP\ugemini_install.ps1\" -Headers $h; & \"$env:TEMP\ugemini_install.ps1\"" +``` + See [gemini/README.md](gemini/README.md) for details. ### Codex CLI — Install -> Codex CLI is a compiled Rust binary (not npm). Install via GitHub releases. +> Codex CLI is a compiled Rust binary (not npm). Installer downloads it from GitHub releases, +> applies config patches and sets `OPENAI_API_KEY` / `OPENAI_BASE_URL` automatically. -**Linux / macOS:** +**Linux (Debian/Ubuntu/RHEL/Fedora):** ```bash curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.sh \ -o /tmp/ucodex_install.sh && sudo bash /tmp/ucodex_install.sh ``` +**macOS (Intel & Apple Silicon):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.sh \ + -o /tmp/ucodex_install.sh && sudo bash /tmp/ucodex_install.sh +``` + +> macOS установит Mach-O бинарь под ваш ARCH (x86_64 / arm64), env-переменные через +> `launchctl setenv` + `~/.zshrc`. Если запросит — введите пароль для `sudo`. + **Windows (PowerShell as Administrator):** ```powershell $h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} @@ -199,45 +222,37 @@ iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/uc . "$env:TEMP\ucodex_install.ps1" ``` -Verify: `codex exec "Hello"` +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.ps1' -OutFile \"$env:TEMP\ucodex_install.ps1\" -Headers $h; & \"$env:TEMP\ucodex_install.ps1\"" +``` + +> Windows: бинарь ставится в `%LOCALAPPDATA%\Programs\codex\codex.exe` и добавляется в PATH +> пользователя. После установки **перезапустите CMD/PowerShell** для подхвата env vars. + +Verify (any platform): `codex exec "Hello"` See [codex/README.md](codex/README.md) for details, troubleshooting, and configuration. ### Qwen Code — Install -**Linux / macOS (two commands):** -```bash -npm config set @qwen-code:registry https://npm.sensey24.ru/ -npm install -g @qwen-code/qwen-code -``` +> Установщик подтянет Node.js если его нет, поставит npm-пакет и применит settings. -**Windows (PowerShell):** -```powershell -npm config set "@qwen-code:registry" "https://npm.sensey24.ru/" -npm install -g @qwen-code/qwen-code -``` - -> Node.js required. Install from https://nodejs.org/ if not present. - -Then configure (downloads patcher automatically): -```bash -curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ - https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.sh \ - -o /tmp/uqwen_install.sh && sudo bash /tmp/uqwen_install.sh -``` - -Verify: `qwen -p "Hello"` - -**Alternative — Automatic installer:** - -Linux / macOS: +**Linux (Debian/Ubuntu/RHEL/Fedora):** ```bash curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.sh \ -o /tmp/uqwen.sh && sudo bash /tmp/uqwen.sh ``` -Windows (PowerShell as Administrator): +**macOS (Intel & Apple Silicon):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.sh \ + -o /tmp/uqwen.sh && sudo bash /tmp/uqwen.sh +``` + +**Windows (PowerShell as Administrator):** ```powershell $h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} Set-ExecutionPolicy Bypass -Scope Process -Force @@ -245,6 +260,29 @@ iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqw . "$env:TEMP\uqwen_install.ps1" ``` +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.ps1' -OutFile \"$env:TEMP\uqwen_install.ps1\" -Headers $h; & \"$env:TEMP\uqwen_install.ps1\"" +``` + +Verify: `qwen -p "Hello"` + +**Alternative — npm install (manual):** + +Linux / macOS: +```bash +npm config set @qwen-code:registry https://npm.sensey24.ru/ +npm install -g @qwen-code/qwen-code +python3 qwen_patcher.py --settings-only +``` + +Windows (PowerShell): +```powershell +npm config set "@qwen-code:registry" "https://npm.sensey24.ru/" +npm install -g @qwen-code/qwen-code +python qwen_patcher.py --settings-only +``` + See [qwen/README.md](qwen/README.md) for details, models, and troubleshooting. ### Manual install from release @@ -302,6 +340,11 @@ Set-ExecutionPolicy Bypass -Scope Process -Force . "$env:TEMP\ugemini_update.ps1" ``` +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_update.ps1' -OutFile \"$env:TEMP\ugemini_update.ps1\" -Headers $h; & \"$env:TEMP\ugemini_update.ps1\"" +``` + ### Codex CLI — Update **Linux / macOS:** @@ -319,6 +362,11 @@ Set-ExecutionPolicy Bypass -Scope Process -Force . "$env:TEMP\ucodex_update.ps1" ``` +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_update.ps1' -OutFile \"$env:TEMP\ucodex_update.ps1\" -Headers $h; & \"$env:TEMP\ucodex_update.ps1\"" +``` + ### Qwen Code — Update **Linux / macOS:** @@ -336,6 +384,11 @@ Set-ExecutionPolicy Bypass -Scope Process -Force . "$env:TEMP\uqwen_update.ps1" ``` +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_update.ps1' -OutFile \"$env:TEMP\uqwen_update.ps1\" -Headers $h; & \"$env:TEMP\uqwen_update.ps1\"" +``` + ## Uninstall **Linux / macOS:** diff --git a/codex/README.md b/codex/README.md index d629356..213572a 100755 --- a/codex/README.md +++ b/codex/README.md @@ -1,7 +1,7 @@ # Codex CLI — Patched Patched OpenAI Codex CLI for use with custom API endpoints. -Latest: **v0.111.0** (6 config patches). +Latest: **v0.116.0** (6 config patches). > Codex CLI — это compiled Rust binary. В отличие от Claude Code и Gemini CLI (JavaScript), > патчинг выполняется через `config.toml` + переменные окружения. @@ -10,33 +10,73 @@ Latest: **v0.111.0** (6 config patches). ### Требования -- **Python 3.11+** (для `tomllib`) -- **curl** (для скачивания бинарника) -- **Linux x86_64 или aarch64** (macOS/Windows — вручную) +- **Python 3.11+** (для `tomllib`) — на Windows опционально (есть PowerShell-fallback) +- **curl** (Linux/macOS) или **PowerShell 5+** (Windows 10+ — встроенный) +- Поддерживаемые платформы: **Linux x86_64/aarch64**, **macOS x86_64/arm64**, **Windows x86_64** -### Быстрая установка (Linux) +### Установка одной командой + +**Linux (Debian/Ubuntu/RHEL/Fedora):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.sh \ + -o /tmp/ucodex_install.sh && sudo bash /tmp/ucodex_install.sh +``` + +**macOS (Intel & Apple Silicon):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.sh \ + -o /tmp/ucodex_install.sh && sudo bash /tmp/ucodex_install.sh +``` + +> Бинарь устанавливается в `/usr/local/bin/.codex-bin`, wrapper — в `/usr/local/bin/codex`. +> Env vars (`OPENAI_API_KEY`, `OPENAI_BASE_URL`) пробрасываются через `launchctl setenv` +> и `~/.zshrc` / `~/.bashrc` (на Linux — `/etc/environment` + `/etc/profile.d/codex-env.sh`). + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.ps1" -OutFile "$env:TEMP\ucodex_install.ps1" -Headers $h +. "$env:TEMP\ucodex_install.ps1" +``` + +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_install.ps1' -OutFile \"$env:TEMP\ucodex_install.ps1\" -Headers $h; & \"$env:TEMP\ucodex_install.ps1\"" +``` + +> Windows: бинарь ставится в `%LOCALAPPDATA%\Programs\codex\codex.exe` и автоматически +> добавляется в PATH пользователя. Env vars (`OPENAI_API_KEY`, `OPENAI_BASE_URL`) ставятся +> через `setx` + `[Environment]::SetEnvironmentVariable("...", "...", "User")`. +> **После установки перезапустите CMD/PowerShell** для подхвата env vars и PATH. + +### Установка из репозитория (любая платформа) ```bash -# 1. Клонировать репо (или скачать файлы) git clone https://git.sensey24.ru/aibot777/unlimitedcoding.git cd unlimitedcoding/codex -# 2. Настроить конфиг — указать свой API endpoint и ключ +# 1) Настроить конфиг cp codex_config.example.json codex_config.json -nano codex_config.json # Изменить base_url и api_key +# Редактировать base_url и api_key в codex_config.json -# 3. Установить бинарник + применить патчи +# 2a) Linux/macOS: sudo bash ucodex_install.sh + +# 2b) Windows PowerShell (Administrator): +powershell -ExecutionPolicy Bypass -File ucodex_install.ps1 ``` -### Ручная установка (шаг за шагом) +### Ручная установка (шаг за шагом, Linux/macOS) **Шаг 1 — Установить бинарник Codex CLI:** ```bash # Скачать последнюю версию с GitHub sudo bash update-codex.sh -codex --version # Должно показать: codex-cli 0.111.0 +codex --version # Должно показать: codex-cli 0.116.0 ``` **Шаг 2 — Настроить конфиг:** @@ -89,7 +129,29 @@ codex exec "What is 2+2? Reply with just the number" ## Обновление -### Обновить бинарник Codex CLI +### Одной командой + +**Linux / macOS:** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_update.sh \ + -o /tmp/ucodex_update.sh && sudo bash /tmp/ucodex_update.sh +``` + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_update.ps1" -OutFile "$env:TEMP\ucodex_update.ps1" -Headers $h +. "$env:TEMP\ucodex_update.ps1" +``` + +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_update.ps1' -OutFile \"$env:TEMP\ucodex_update.ps1\" -Headers $h; & \"$env:TEMP\ucodex_update.ps1\"" +``` + +### Обновить бинарник Codex CLI вручную (Linux/macOS) ```bash cd unlimitedcoding/codex @@ -158,6 +220,25 @@ env_key = "OPENAI_API_KEY" wire_api = "responses" ``` +## Удаление (Uninstall) + +**Linux / macOS:** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_uninstall.sh \ + -o /tmp/ucodex_uninstall.sh && sudo bash /tmp/ucodex_uninstall.sh +``` + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex/ucodex_uninstall.ps1" -OutFile "$env:TEMP\ucodex_uninstall.ps1" -Headers $h +. "$env:TEMP\ucodex_uninstall.ps1" +``` + +Удаляются: бинарь, `~/.codex/`, env vars, wrapper, PATH-запись. + ## Rollback Восстановить оригинальный конфиг: @@ -171,29 +252,58 @@ python3 codex_patcher.py --rollback ### "Error loading configuration: missing field `name`" Обновите патчер (`git pull`) и перезапустите: `python3 codex_patcher.py --apply` -### codex не запускается (segfault / GLIBC) +### codex не запускается (segfault / GLIBC) — Linux Скрипт `update-codex.sh` скачивает musl-версию для совместимости. Если проблема остаётся: ```bash -# Проверить бинарник -file /usr/local/bin/codex -ldd /usr/local/bin/codex # Должно быть "not a dynamic executable" (static) +file /usr/local/bin/.codex-bin +ldd /usr/local/bin/.codex-bin # Должно быть "not a dynamic executable" (static) +``` + +### macOS: "codex" cannot be opened because the developer cannot be verified +```bash +xattr -d com.apple.quarantine /usr/local/bin/.codex-bin +``` + +### Windows: "codex is not recognized" +Перезапустите CMD/PowerShell. Либо вручную обновите PATH в текущей сессии: +```powershell +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") ``` ### "OPENAI_API_KEY not set" -```bash -# Вариант 1: Перезайти в shell (env vars из /etc/environment) -source /etc/environment -# Вариант 2: Установить вручную +**Linux:** +```bash +source /etc/environment +# или export OPENAI_BASE_URL="https://your-endpoint/v1" export OPENAI_API_KEY="your-key" ``` +**macOS:** +```bash +source /etc/codex-env.sh +# или перезайти в shell (zsh подхватит из ~/.zshrc) +``` + +**Windows (PowerShell):** +```powershell +[System.Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "your-key", "User") +[System.Environment]::SetEnvironmentVariable("OPENAI_BASE_URL", "https://your-endpoint/v1", "User") +# Перезапустите PowerShell +``` + +**Windows (CMD):** +```cmd +setx OPENAI_API_KEY "your-key" +setx OPENAI_BASE_URL "https://your-endpoint/v1" +``` + ### Permissions промпты всё ещё появляются Убедитесь что config.toml содержит `approval_policy = "never"`: -```bash -cat ~/.codex/config.toml | grep approval -``` + +Linux/macOS: `cat ~/.codex/config.toml | grep approval` +Windows: `type %USERPROFILE%\.codex\config.toml | findstr approval` ## Структура файлов @@ -204,7 +314,12 @@ codex/ ├── codex_config.example.json # Пример конфига ├── update_codex_patcher.py # Pipeline CLI ├── update-codex.sh # Бинарный updater с GitHub -├── ucodex_install.sh # One-liner installer +├── ucodex_install.sh # One-liner installer (Linux/macOS) +├── ucodex_install.ps1 # One-liner installer (Windows) +├── ucodex_update.sh # Update script (Linux/macOS) +├── ucodex_update.ps1 # Update script (Windows) +├── ucodex_uninstall.sh # Uninstaller (Linux/macOS) +├── ucodex_uninstall.ps1 # Uninstaller (Windows) └── updater/ ├── __init__.py └── config_validator.py # Валидация 6 targets diff --git a/gemini/README.md b/gemini/README.md index 7646c4c..032ae1d 100755 --- a/gemini/README.md +++ b/gemini/README.md @@ -5,9 +5,54 @@ Patched Gemini CLI for use with custom API endpoints. Latest: **v0.35.3** (13 patches). -## npm Install (Recommended) +> Node.js v20+ required. One-liner installer подтянет Node.js если его нет. -**Step 1 — Install patched CLI:** +## Install + +### One-liner — все платформы + +**Linux (Debian/Ubuntu/RHEL/Fedora):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.sh \ + -o /tmp/ugemini_install.sh && sudo bash /tmp/ugemini_install.sh +``` + +**macOS (Intel & Apple Silicon):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.sh \ + -o /tmp/ugemini_install.sh && sudo bash /tmp/ugemini_install.sh +``` + +> macOS: env vars (`GEMINI_API_KEY`, `GOOGLE_GEMINI_BASE_URL`) добавляются в `~/.zshrc`. +> Если sudo попросит — введите пароль. + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.ps1" -OutFile "$env:TEMP\ugemini_install.ps1" -Headers $h +. "$env:TEMP\ugemini_install.ps1" +``` + +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.ps1' -OutFile \"$env:TEMP\ugemini_install.ps1\" -Headers $h; & \"$env:TEMP\ugemini_install.ps1\"" +``` + +> Windows: после установки **перезапустите CMD/PowerShell** для подхвата env vars и PATH. + +Установщик выполнит: +1. Проверит prerequisites (Node.js >= 20, Python3) +2. Установит `@google/gemini-cli` если нет +3. Скачает и применит 13 патчей +4. Настроит auth и env vars +5. Проверит тестовым промптом + +### Two-command npm install (manual) + +Если установщик не подходит — можно вручную через npm registry: **Linux / macOS:** ```bash @@ -21,113 +66,132 @@ npm config set "@google:registry" "https://npm.sensey24.ru/" npm install -g @google/gemini-cli ``` -> Node.js required. Install from https://nodejs.org/ if not present. +**Windows (CMD):** +```cmd +npm config set "@google:registry" "https://npm.sensey24.ru/" +npm install -g @google/gemini-cli +``` -**Step 2 — Configure settings and environment:** +После npm-установки нужно вручную настроить auth и env vars (см. ниже). -The npm package includes all 13 patches baked in (proxy URLs, model defaults, UI, compression). -You still need to configure auth and env vars: +### Manual configure (если устанавливали через npm) + +npm-пакет содержит все 13 патчей (proxy URLs, model defaults, UI, compression). +Нужно лишь настроить auth и env vars. **Linux / macOS:** ```bash -# Set environment variables echo 'export GEMINI_API_KEY="ClauderAPI2"' >> ~/.bashrc echo 'export GOOGLE_GEMINI_BASE_URL="https://ai.37-187-136-86.sslip.io"' >> ~/.bashrc source ~/.bashrc -# Configure auth (switch from OAuth to API key) mkdir -p ~/.gemini cat > ~/.gemini/settings.json << 'EOF' { "security": { - "auth": { - "selectedType": "gemini-api-key" - } + "auth": { "selectedType": "gemini-api-key" }, + "folderTrust": { "enabled": false } }, - "telemetry": { - "enabled": false, - "logPrompts": false - } + "telemetry": { "enabled": false, "logPrompts": false }, + "general": { "defaultApprovalMode": "yolo" } } EOF ``` -**Windows (PowerShell):** -```powershell -# Set environment variables -[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "ClauderAPI2", "User") -[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://ai.37-187-136-86.sslip.io", "User") - -# Configure auth -$geminiDir = "$env:USERPROFILE\.gemini" -New-Item -ItemType Directory -Force -Path $geminiDir | Out-Null -@' -{ - "security": { - "auth": { - "selectedType": "gemini-api-key" - } - }, - "telemetry": { - "enabled": false, - "logPrompts": false - } -} -'@ | Set-Content "$geminiDir\settings.json" -Encoding UTF8 +**macOS (zsh — default):** +```bash +echo 'export GEMINI_API_KEY="ClauderAPI2"' >> ~/.zshrc +echo 'export GOOGLE_GEMINI_BASE_URL="https://ai.37-187-136-86.sslip.io"' >> ~/.zshrc +source ~/.zshrc ``` -**Step 3 — Verify:** +**Windows (PowerShell):** +```powershell +[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "ClauderAPI2", "User") +[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://ai.37-187-136-86.sslip.io", "User") +$env:GEMINI_API_KEY = "ClauderAPI2" +$env:GOOGLE_GEMINI_BASE_URL = "https://ai.37-187-136-86.sslip.io" +$d = "$env:USERPROFILE\.gemini"; New-Item -ItemType Directory -Force -Path $d | Out-Null +[System.IO.File]::WriteAllText("$d\settings.json", '{"security":{"auth":{"selectedType":"gemini-api-key"},"folderTrust":{"enabled":false}},"telemetry":{"enabled":false,"logPrompts":false},"general":{"defaultApprovalMode":"yolo"}}') +``` + +**Windows (CMD):** +```cmd +setx GEMINI_API_KEY "ClauderAPI2" +setx GOOGLE_GEMINI_BASE_URL "https://ai.37-187-136-86.sslip.io" +mkdir "%USERPROFILE%\.gemini" 2>nul +echo {"security":{"auth":{"selectedType":"gemini-api-key"},"folderTrust":{"enabled":false}},"telemetry":{"enabled":false,"logPrompts":false},"general":{"defaultApprovalMode":"yolo"}} > "%USERPROFILE%\.gemini\settings.json" +``` + +### Verify + ```bash gemini -p "Hello" ``` -### What's included in the npm package vs what needs manual setup +## Update + +### One-liner + +**Linux / macOS:** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_update.sh \ + -o /tmp/ugemini_update.sh && sudo bash /tmp/ugemini_update.sh +``` + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_update.ps1" -OutFile "$env:TEMP\ugemini_update.ps1" -Headers $h +. "$env:TEMP\ugemini_update.ps1" +``` + +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_update.ps1' -OutFile \"$env:TEMP\ugemini_update.ps1\" -Headers $h; & \"$env:TEMP\ugemini_update.ps1\"" +``` + +### Manual update via npm + +```bash +npm install -g @google/gemini-cli +``` + +Settings и env vars сохраняются между обновлениями. + +## Uninstall + +**Linux / macOS:** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_uninstall.sh \ + -o /tmp/ugemini_uninstall.sh && sudo bash /tmp/ugemini_uninstall.sh +``` + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_uninstall.ps1" -OutFile "$env:TEMP\ugemini_uninstall.ps1" -Headers $h +. "$env:TEMP\ugemini_uninstall.ps1" +``` + +Удаляются: npm-пакет, `~/.gemini/`, env vars, npm registry config. + +## What's included in the npm package vs what needs manual setup | Patch | What | Included in npm? | |-------|------|:-:| | 1-3 | Proxy URLs (API + Vertex) | Yes | | 4-5 | Sandbox fixes (env vars + whitelist) | Yes | -| 6 | Auth settings (~/.gemini/settings.json) | **No — Step 2** | +| 6 | Auth settings (~/.gemini/settings.json) | **No — manual** | | 7-8 | Auto-update registry + commands | Yes | | 9 | Auto-permissions (YOLO mode) | Yes | | 10 | Default model constants (3.x) | Yes | | 11-13 | UI descriptions + compression aliases | Yes | -### Update - -Same install commands — npm will pull the latest patched version from our registry. -Settings and env vars persist across updates. - -## One-Line Install (Alternative) - -```bash -curl -fsSL https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.sh | sudo bash -``` - -This will: -1. Check prerequisites (Node.js >= 20, Python3) -2. Install `@google/gemini-cli` if not present -3. Download and apply 13 patches -4. Configure auth and env vars -5. Verify with a test prompt - -## Manual Install - -```bash -# 1. Install Gemini CLI -npm install -g @google/gemini-cli - -# 2. Download patcher -curl -fsSL https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/gemini_patcher.py -o /tmp/gemini_patcher.py -curl -fsSL https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/gemini_config.json -o /tmp/gemini_config.json - -# 3. Apply patches -sudo python3 /tmp/gemini_patcher.py --apply --config /tmp/gemini_config.json - -# 4. Test -gemini -p "Hello" -``` - ## What Gets Patched | # | Target | What | @@ -158,19 +222,51 @@ gemini -p "Hello" ## Troubleshooting -**"GEMINI_API_KEY not set"** +### "GEMINI_API_KEY not set" + +**Linux / macOS:** ```bash export GEMINI_API_KEY="ClauderAPI2" export GOOGLE_GEMINI_BASE_URL="https://ai.37-187-136-86.sslip.io" ``` -**"IneligibleTierError"** -Settings still using OAuth. Re-run patcher: +**Windows (PowerShell):** +```powershell +[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "ClauderAPI2", "User") +[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://ai.37-187-136-86.sslip.io", "User") +# Перезапустите PowerShell +``` + +**Windows (CMD):** +```cmd +setx GEMINI_API_KEY "ClauderAPI2" +setx GOOGLE_GEMINI_BASE_URL "https://ai.37-187-136-86.sslip.io" +``` + +### "IneligibleTierError" + +Settings ещё используют OAuth. Перезапустите патчер: ```bash python3 gemini_patcher.py --settings-only ``` -**Rollback** +### Windows: "gemini is not recognized" + +Перезапустите CMD/PowerShell. Либо вручную обновите PATH в текущей сессии: +```powershell +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +``` + +### Deprecated settings spam + +Если видите повторяющиеся warnings: +``` +The system configuration contains deprecated settings: [experimental.codebaseInvestigatorSettings] +``` +ключ есть в **system-level** конфигах. Удалите его — см. секцию Troubleshooting в [главном README](../README.md#gemini-cli-deprecated-settings-spam). + +### Rollback + ```bash sudo python3 gemini_patcher.py --rollback ``` @@ -181,5 +277,7 @@ sudo python3 gemini_patcher.py --rollback |------|---------| | `gemini_patcher.py` | Main patcher — detects Gemini CLI, applies 13 patches | | `gemini_config.json` | Config — proxy URL, API key, models | -| `ugemini_install.sh` | One-line installer | +| `ugemini_install.sh` / `.ps1` | One-liner installer (Linux/macOS / Windows) | +| `ugemini_update.sh` / `.ps1` | Update script (Linux/macOS / Windows) | +| `ugemini_uninstall.sh` / `.ps1` | Uninstaller (Linux/macOS / Windows) | | `releases/index.json` | Version index | diff --git a/gemini/ugemini_uninstall.sh b/gemini/ugemini_uninstall.sh index d95b877..343ccd4 100755 --- a/gemini/ugemini_uninstall.sh +++ b/gemini/ugemini_uninstall.sh @@ -1,85 +1,114 @@ -#!/usr/bin/env bash -# Gemini CLI — Uninstaller -# Removes Gemini CLI, settings, env vars, and npm registry config. -# -# Usage: sudo bash ugemini_uninstall.sh -set -euo pipefail - -GREEN="\033[92m" -RED="\033[91m" -CYAN="\033[96m" -YELLOW="\033[93m" -BOLD="\033[1m" -RESET="\033[0m" - -log() { echo -e "${GREEN}[+]${RESET} $*"; } -warn() { echo -e "${YELLOW}[~]${RESET} $*"; } -info() { echo -e "${CYAN}[i]${RESET} $*"; } - -echo -e "${BOLD}" -echo " +--------------------------------------+" -echo " | Gemini CLI — Uninstaller |" -echo " +--------------------------------------+" -echo -e "${RESET}" - -# ---- Uninstall npm package ---- - -if command -v gemini &>/dev/null || npm list -g @google/gemini-cli &>/dev/null 2>&1; then - info "Removing @google/gemini-cli..." - npm uninstall -g @google/gemini-cli 2>/dev/null || true - log "npm package removed" -else - warn "Gemini CLI not found in npm global packages" -fi - -# ---- Remove settings ---- - -for user_home in /root /home/*; do - GEMINI_DIR="$user_home/.gemini" - if [ -d "$GEMINI_DIR" ]; then - info "Removing $GEMINI_DIR..." - rm -rf "$GEMINI_DIR" - log "Removed $GEMINI_DIR" - fi -done - -# ---- Remove env vars from shell rc files ---- - -for user_home in /root /home/*; do - for rc_file in "$user_home/.bashrc" "$user_home/.zshrc"; do - if [ -f "$rc_file" ] && grep -q 'GEMINI_API_KEY\|GOOGLE_GEMINI_BASE_URL\|Gemini CLI' "$rc_file" 2>/dev/null; then - info "Cleaning env vars from $rc_file..." - sed -i '/# Gemini CLI/d' "$rc_file" - sed -i '/GEMINI_API_KEY/d' "$rc_file" - sed -i '/GOOGLE_GEMINI_BASE_URL/d' "$rc_file" - log "Cleaned $rc_file" - fi - done -done - -# ---- Remove /etc/profile.d script ---- - -if [ -f "/etc/profile.d/gemini-cli.sh" ]; then - info "Removing /etc/profile.d/gemini-cli.sh..." - rm -f "/etc/profile.d/gemini-cli.sh" - log "Removed /etc/profile.d/gemini-cli.sh" -fi - -# ---- Remove env vars from /etc/environment ---- - -if [ -f "/etc/environment" ] && grep -q 'GEMINI_API_KEY\|GOOGLE_GEMINI_BASE_URL' /etc/environment 2>/dev/null; then - info "Cleaning /etc/environment..." - sed -i '/GEMINI_API_KEY/d' /etc/environment - sed -i '/GOOGLE_GEMINI_BASE_URL/d' /etc/environment - log "Cleaned /etc/environment" -fi - -# ---- Remove npm registry config ---- - -info "Removing npm registry config..." -npm config delete @google:registry 2>/dev/null || true -log "npm registry config removed" - -echo "" -echo -e "${GREEN}${BOLD} Gemini CLI fully uninstalled!${RESET}" -echo "" +#!/usr/bin/env bash +# Gemini CLI — Uninstaller +# Removes Gemini CLI, settings, env vars, and npm registry config. +# +# Usage: sudo bash ugemini_uninstall.sh +set -euo pipefail + +GREEN="\033[92m" +RED="\033[91m" +CYAN="\033[96m" +YELLOW="\033[93m" +BOLD="\033[1m" +RESET="\033[0m" + +log() { echo -e "${GREEN}[+]${RESET} $*"; } +warn() { echo -e "${YELLOW}[~]${RESET} $*"; } +info() { echo -e "${CYAN}[i]${RESET} $*"; } + +OS="$(uname -s)" +IS_MACOS=false +[ "$OS" = "Darwin" ] && IS_MACOS=true + +sedi() { + if $IS_MACOS; then + sed -i '' "$@" + else + sed -i "$@" + fi +} + +if $IS_MACOS; then + SCAN_DIRS="/Users" +else + SCAN_DIRS="/home" +fi + +echo -e "${BOLD}" +echo " +--------------------------------------+" +echo " | Gemini CLI — Uninstaller |" +echo " +--------------------------------------+" +echo -e "${RESET}" + +# ---- Uninstall npm package ---- + +if command -v gemini &>/dev/null || npm list -g @google/gemini-cli &>/dev/null 2>&1; then + info "Removing @google/gemini-cli..." + npm uninstall -g @google/gemini-cli 2>/dev/null || true + log "npm package removed" +else + warn "Gemini CLI not found in npm global packages" +fi + +# ---- Remove settings ---- + +for user_home in /root $SCAN_DIRS/*; do + GEMINI_DIR="$user_home/.gemini" + if [ -d "$GEMINI_DIR" ]; then + info "Removing $GEMINI_DIR..." + rm -rf "$GEMINI_DIR" + log "Removed $GEMINI_DIR" + fi +done + +# ---- Remove env vars from shell rc files ---- + +for user_home in /root $SCAN_DIRS/*; do + for rc_file in "$user_home/.bashrc" "$user_home/.zshrc"; do + if [ -f "$rc_file" ] && grep -q 'GEMINI_API_KEY\|GOOGLE_GEMINI_BASE_URL\|Gemini CLI\|gemini-cli-env' "$rc_file" 2>/dev/null; then + info "Cleaning env vars from $rc_file..." + sedi '/# Gemini CLI/d' "$rc_file" + sedi '/gemini-cli-env\.sh/d' "$rc_file" + sedi '/GEMINI_API_KEY/d' "$rc_file" + sedi '/GOOGLE_GEMINI_BASE_URL/d' "$rc_file" + log "Cleaned $rc_file" + fi + done +done + +# ---- Remove env files ---- + +for env_file in "/etc/profile.d/gemini-cli.sh" "/etc/gemini-cli-env.sh"; do + if [ -f "$env_file" ]; then + info "Removing $env_file..." + rm -f "$env_file" + log "Removed $env_file" + fi +done + +# ---- Remove launchctl env vars (macOS) ---- + +if $IS_MACOS; then + launchctl unsetenv GEMINI_API_KEY 2>/dev/null || true + launchctl unsetenv GOOGLE_GEMINI_BASE_URL 2>/dev/null || true + log "launchctl env vars cleared" +fi + +# ---- Remove env vars from /etc/environment (Linux) ---- + +if [ -f "/etc/environment" ] && grep -q 'GEMINI_API_KEY\|GOOGLE_GEMINI_BASE_URL' /etc/environment 2>/dev/null; then + info "Cleaning /etc/environment..." + sedi '/GEMINI_API_KEY/d' /etc/environment + sedi '/GOOGLE_GEMINI_BASE_URL/d' /etc/environment + log "Cleaned /etc/environment" +fi + +# ---- Remove npm registry config ---- + +info "Removing npm registry config..." +npm config delete @google:registry 2>/dev/null || true +log "npm registry config removed" + +echo "" +echo -e "${GREEN}${BOLD} Gemini CLI fully uninstalled!${RESET}" +echo "" diff --git a/qwen/README.md b/qwen/README.md index 05e6c0e..0512351 100755 --- a/qwen/README.md +++ b/qwen/README.md @@ -1,99 +1,203 @@ -# Qwen Code Patcher - -Patches [QwenCode CLI](https://github.com/QwenLM/qwen-code) (`@qwen-code/qwen-code`) to route all API requests through a custom AI proxy, disable telemetry, and auto-configure settings. - -**[RU]** Патчер для QwenCode CLI — перенаправляет API запросы через пользовательский AI прокси, отключает телеметрию, автоматически настраивает окружение. - -## Quick Start - -```bash -# 1. Install from private registry -npm config set @qwen-code:registry https://npm.sensey24.ru/ -npm install -g @qwen-code/qwen-code - -# 2. Apply settings (env vars + settings.json) -python3 qwen_patcher.py --settings-only - -# 3. Verify -qwen -p "Say hello" -``` - -## Windows - -```powershell -npm config set "@qwen-code:registry" "https://npm.sensey24.ru/" -npm install -g @qwen-code/qwen-code -python3 qwen_patcher.py --settings-only -``` - -## Update - -Same two commands — npm will pull the latest patched version: - -```bash -npm config set @qwen-code:registry https://npm.sensey24.ru/ -npm install -g @qwen-code/qwen-code -``` - -## What Gets Patched - -| # | Target | Description | -|---|--------|-------------| -| 1 | telemetry_flag | Force `getTelemetryEnabled()` -> false | -| 2 | telemetry_log_prompts | Force `getTelemetryLogPromptsEnabled()` -> false | -| 3 | telemetry_init_guard | Early return in `initializeTelemetry()` | -| 4 | dashscope_base_url | `DEFAULT_DASHSCOPE_BASE_URL` -> proxy | -| 5 | coding_plan_urls | `coding.dashscope.aliyuncs.com` -> proxy | -| 6 | default_model | Validate `DEFAULT_QWEN_MODEL = "coder-model"` | -| 7 | mainline_model | Validate `MAINLINE_CODER_MODEL = "qwen3.5-plus"` | -| 8 | auto_update_registry | `registry.npmjs.org` -> private registry | -| 9 | auto_update_command | Add `--registry` to update commands | -| 10 | user_settings | Auth type=openai, telemetry=false, model | -| 11 | trusted_folders | Trust /home, /root, /tmp | -| 12 | system_env | OPENAI_API_KEY, OPENAI_BASE_URL, telemetry vars | - -Targets 1-9 are pre-patched in the npm package. Targets 10-12 require running `qwen_patcher.py --settings-only`. - -## Models - -| Model | Description | -|-------|-------------| -| `qwen3.5-plus` | Qwen 3.5 Plus — default | -| `coder-model` | Direct OAuth model name | -| `qwen3-coder-plus` | Qwen3 Coder Plus | -| `qwen3-coder-flash` | Qwen3 Coder Flash (fast) | - -## CLI Usage - -```bash -# Detection -python3 qwen_patcher.py --detect - -# Validation (GREEN/YELLOW/RED for each target) -python3 qwen_patcher.py --validate - -# Full patch (cli.js + settings + env) -python3 qwen_patcher.py --apply - -# Settings only (no cli.js modification) -python3 qwen_patcher.py --settings-only - -# Rollback cli.js from backup -python3 qwen_patcher.py --rollback -``` - -## Troubleshooting - -### "model not supported" error - -Make sure your proxy has `qwen3.5-plus` mapped to `coder-model` in the OAuth model alias config. The Qwen OAuth endpoint only accepts `coder-model` as the model name. - -### CLI doesn't start after patching - -If you applied `--apply` and the CLI fails to start, run `--rollback` to restore from backup, then use the pre-patched npm package instead: - -```bash -python3 qwen_patcher.py --rollback -npm install -g @qwen-code/qwen-code # Re-installs pre-patched version -python3 qwen_patcher.py --settings-only -``` +# Qwen Code Patcher + +Patches [QwenCode CLI](https://github.com/QwenLM/qwen-code) (`@qwen-code/qwen-code`) to route all API requests through a custom AI proxy, disable telemetry, and auto-configure settings. + +**[RU]** Патчер для QwenCode CLI — перенаправляет API запросы через пользовательский AI прокси, отключает телеметрию, автоматически настраивает окружение. + +Latest target version: **v0.14.5** (12 patches). + +## Install + +> Node.js v20+ required. Установщик подтянет Node.js если его нет. + +### One-liner — все платформы + +**Linux (Debian/Ubuntu/RHEL/Fedora):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.sh \ + -o /tmp/uqwen_install.sh && sudo bash /tmp/uqwen_install.sh +``` + +**macOS (Intel & Apple Silicon):** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.sh \ + -o /tmp/uqwen_install.sh && sudo bash /tmp/uqwen_install.sh +``` + +> macOS: env vars (`OPENAI_API_KEY`, `OPENAI_BASE_URL`) добавляются в `~/.zshrc`. +> Если sudo попросит — введите пароль. + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.ps1" -OutFile "$env:TEMP\uqwen_install.ps1" -Headers $h +. "$env:TEMP\uqwen_install.ps1" +``` + +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.ps1' -OutFile \"$env:TEMP\uqwen_install.ps1\" -Headers $h; & \"$env:TEMP\uqwen_install.ps1\"" +``` + +> Windows: после установки **перезапустите CMD/PowerShell** для подхвата env vars и PATH. + +### Two-command npm install (manual) + +Если установщик не подходит — можно вручную через npm registry, а потом применить settings. + +**Linux / macOS:** +```bash +npm config set @qwen-code:registry https://npm.sensey24.ru/ +npm install -g @qwen-code/qwen-code +python3 qwen_patcher.py --settings-only +``` + +**Windows (PowerShell):** +```powershell +npm config set "@qwen-code:registry" "https://npm.sensey24.ru/" +npm install -g @qwen-code/qwen-code +python qwen_patcher.py --settings-only +``` + +**Windows (CMD):** +```cmd +npm config set "@qwen-code:registry" "https://npm.sensey24.ru/" +npm install -g @qwen-code/qwen-code +python qwen_patcher.py --settings-only +``` + +### Verify + +```bash +qwen -p "Say hello" +``` + +## Update + +### One-liner + +**Linux / macOS:** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_update.sh \ + -o /tmp/uqwen_update.sh && sudo bash /tmp/uqwen_update.sh +``` + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_update.ps1" -OutFile "$env:TEMP\uqwen_update.ps1" -Headers $h +. "$env:TEMP\uqwen_update.ps1" +``` + +**Windows (CMD as Administrator):** +```cmd +powershell -NoProfile -ExecutionPolicy Bypass -Command "$h=@{Authorization='token cadffcb0a6a3be728ac1ff619bb40c86588f6837'}; iwr 'https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_update.ps1' -OutFile \"$env:TEMP\uqwen_update.ps1\" -Headers $h; & \"$env:TEMP\uqwen_update.ps1\"" +``` + +### Manual update via npm + +Same install commands — npm подтянет последнюю патченую версию из приватного registry. + +```bash +npm install -g @qwen-code/qwen-code +``` + +## Uninstall + +**Linux / macOS:** +```bash +curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \ + https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_uninstall.sh \ + -o /tmp/uqwen_uninstall.sh && sudo bash /tmp/uqwen_uninstall.sh +``` + +**Windows (PowerShell as Administrator):** +```powershell +$h=@{Authorization="token cadffcb0a6a3be728ac1ff619bb40c86588f6837"} +Set-ExecutionPolicy Bypass -Scope Process -Force +iwr "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_uninstall.ps1" -OutFile "$env:TEMP\uqwen_uninstall.ps1" -Headers $h +. "$env:TEMP\uqwen_uninstall.ps1" +``` + +Удаляются: npm-пакет, `~/.qwen/`, env vars, npm registry config. + +## What Gets Patched + +| # | Target | Description | +|---|--------|-------------| +| 1 | telemetry_flag | Force `getTelemetryEnabled()` -> false | +| 2 | telemetry_log_prompts | Force `getTelemetryLogPromptsEnabled()` -> false | +| 3 | telemetry_init_guard | Early return in `initializeTelemetry()` | +| 4 | dashscope_base_url | `DEFAULT_DASHSCOPE_BASE_URL` -> proxy | +| 5 | coding_plan_urls | `coding.dashscope.aliyuncs.com` -> proxy | +| 6 | default_model | Validate `DEFAULT_QWEN_MODEL = "coder-model"` | +| 7 | mainline_model | Validate `MAINLINE_CODER_MODEL = "qwen3.5-plus"` | +| 8 | auto_update_registry | `registry.npmjs.org` -> private registry | +| 9 | auto_update_command | Add `--registry` to update commands | +| 10 | user_settings | Auth type=openai, telemetry=false, model | +| 11 | trusted_folders | Trust /home, /root, /tmp | +| 12 | system_env | OPENAI_API_KEY, OPENAI_BASE_URL, telemetry vars | + +Targets 1-9 are pre-patched in the npm package. Targets 10-12 require running `qwen_patcher.py --settings-only`. + +## Models + +| Model | Description | +|-------|-------------| +| `qwen3.5-plus` | Qwen 3.5 Plus — default | +| `qwen3-coder-plus` | Qwen3 Coder Plus | +| `qwen3-coder-flash` | Qwen3 Coder Flash (fast) | + +## CLI Usage + +```bash +# Detection +python3 qwen_patcher.py --detect + +# Validation (GREEN/YELLOW/RED for each target) +python3 qwen_patcher.py --validate + +# Full patch (cli.js + settings + env) +python3 qwen_patcher.py --apply + +# Settings only (no cli.js modification) +python3 qwen_patcher.py --settings-only + +# Rollback cli.js from backup +python3 qwen_patcher.py --rollback +``` + +## Troubleshooting + +### "model not supported" error + +Make sure your proxy has `qwen3.5-plus` mapped to `coder-model` in the OAuth model alias config. The Qwen OAuth endpoint only accepts `coder-model` as the model name. + +### CLI doesn't start after patching + +If you applied `--apply` and the CLI fails to start, run `--rollback` to restore from backup, then use the pre-patched npm package instead: + +```bash +python3 qwen_patcher.py --rollback +npm install -g @qwen-code/qwen-code # Re-installs pre-patched version +python3 qwen_patcher.py --settings-only +``` + +### Windows: "qwen is not recognized" + +Перезапустите CMD/PowerShell. Либо вручную обновите PATH в текущей сессии: +```powershell +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +``` + +### macOS: env vars not picked up + +Перезайдите в shell или загрузите вручную: +```bash +source ~/.zshrc +``` diff --git a/qwen/uqwen_install.sh b/qwen/uqwen_install.sh index 6a9c85c..2796cba 100755 --- a/qwen/uqwen_install.sh +++ b/qwen/uqwen_install.sh @@ -14,7 +14,24 @@ REGISTRY_URL="https://npm.sensey24.ru/" NPM_SCOPE="@qwen-code" NPM_PACKAGE="@qwen-code/qwen-code" -ENV_FILE="/etc/profile.d/qwen-code.sh" +OS="$(uname -s)" +IS_MACOS=false +[ "$OS" = "Darwin" ] && IS_MACOS=true + +if $IS_MACOS; then + ENV_FILE="/etc/qwen-code-env.sh" +else + ENV_FILE="/etc/profile.d/qwen-code.sh" +fi + +# Cross-platform sed -i (macOS BSD sed requires -i '' while GNU sed uses -i) +sedi() { + if $IS_MACOS; then + sed -i '' "$@" + else + sed -i "$@" + fi +} GREEN="\033[92m" RED="\033[91m" @@ -211,23 +228,55 @@ info "Setting environment variables..." API_KEY=$(python3 -c "import json; print(json.load(open('$INSTALL_DIR/qwen_config.json'))['api_key'])") BASE_URL=$(python3 -c "import json; print(json.load(open('$INSTALL_DIR/qwen_config.json'))['base_url'])") -ETC_ENV="/etc/environment" -for kv in "QWEN_API_KEY=\"$API_KEY\"" "QWEN_BASE_URL=\"$BASE_URL\""; do - KEY="${kv%%=*}" - if grep -q "^${KEY}=" "$ETC_ENV" 2>/dev/null; then - sed -i "s|^${KEY}=.*|${kv}|" "$ETC_ENV" - else - echo "$kv" >> "$ETC_ENV" - fi -done -log "Env vars written to $ETC_ENV" +if $IS_MACOS; then + # macOS: no /etc/environment, no /etc/profile.d + launchctl setenv QWEN_API_KEY "$API_KEY" 2>/dev/null || true + launchctl setenv QWEN_BASE_URL "$BASE_URL" 2>/dev/null || true + log "Env vars set via launchctl" -cat > "$ENV_FILE" << PROF_EOF + cat > "$ENV_FILE" << ENVEOF +export QWEN_API_KEY="$API_KEY" +export QWEN_BASE_URL="$BASE_URL" +ENVEOF + chmod 644 "$ENV_FILE" + log "Env file: $ENV_FILE" + + # Add source to user shell rc files + REAL_HOME="$HOME" + if [ -n "${SUDO_USER:-}" ] && [ "$SUDO_USER" != "root" ]; then + REAL_HOME=$(eval echo "~$SUDO_USER") + fi + for rc_file in "$REAL_HOME/.zshrc" "$REAL_HOME/.bashrc"; do + if [ -f "$rc_file" ] || [ "$rc_file" = "$REAL_HOME/.zshrc" ]; then + if [ -f "$rc_file" ]; then + sedi '/# Qwen env/d' "$rc_file" + sedi '/qwen-code-env\.sh/d' "$rc_file" + fi + echo "[ -f $ENV_FILE ] && . $ENV_FILE # Qwen env" >> "$rc_file" + log "Added source to $rc_file" + fi + done +else + # Linux: /etc/environment for all users + ETC_ENV="/etc/environment" + for kv in "QWEN_API_KEY=\"$API_KEY\"" "QWEN_BASE_URL=\"$BASE_URL\""; do + KEY="${kv%%=*}" + if grep -q "^${KEY}=" "$ETC_ENV" 2>/dev/null; then + sedi "s|^${KEY}=.*|${kv}|" "$ETC_ENV" + else + echo "$kv" >> "$ETC_ENV" + fi + done + log "Env vars written to $ETC_ENV" + + mkdir -p /etc/profile.d + cat > "$ENV_FILE" << PROF_EOF export QWEN_API_KEY="$API_KEY" export QWEN_BASE_URL="$BASE_URL" PROF_EOF -chmod 644 "$ENV_FILE" -log "Env file: $ENV_FILE" + chmod 644 "$ENV_FILE" + log "Env file: $ENV_FILE" +fi # ---- Create wrapper (auto-loads env) ---- diff --git a/qwen/uqwen_uninstall.sh b/qwen/uqwen_uninstall.sh index 5a4338e..38532db 100755 --- a/qwen/uqwen_uninstall.sh +++ b/qwen/uqwen_uninstall.sh @@ -1,85 +1,115 @@ -#!/usr/bin/env bash -# Qwen Code — Uninstaller -# Removes Qwen Code CLI, settings, env vars, and npm registry config. -# -# Usage: sudo bash uqwen_uninstall.sh -set -euo pipefail - -GREEN="\033[92m" -RED="\033[91m" -CYAN="\033[96m" -YELLOW="\033[93m" -BOLD="\033[1m" -RESET="\033[0m" - -log() { echo -e "${GREEN}[+]${RESET} $*"; } -warn() { echo -e "${YELLOW}[~]${RESET} $*"; } -info() { echo -e "${CYAN}[i]${RESET} $*"; } - -echo -e "${BOLD}" -echo " +--------------------------------------+" -echo " | Qwen Code — Uninstaller |" -echo " +--------------------------------------+" -echo -e "${RESET}" - -# ---- Uninstall npm package ---- - -if npm list -g @qwen-code/qwen-code &>/dev/null 2>&1; then - info "Removing @qwen-code/qwen-code..." - npm uninstall -g @qwen-code/qwen-code 2>/dev/null || true - log "npm package removed" -else - warn "Qwen Code not found in npm global packages" -fi - -# ---- Remove settings ---- - -for user_home in /root /home/*; do - QWEN_DIR="$user_home/.qwen" - if [ -d "$QWEN_DIR" ]; then - info "Removing $QWEN_DIR..." - rm -rf "$QWEN_DIR" - log "Removed $QWEN_DIR" - fi -done - -# ---- Remove env vars from shell rc files ---- - -for user_home in /root /home/*; do - for rc_file in "$user_home/.bashrc" "$user_home/.zshrc"; do - if [ -f "$rc_file" ] && grep -q 'QWEN_API_KEY\|QWEN_BASE_URL\|Qwen Code' "$rc_file" 2>/dev/null; then - info "Cleaning env vars from $rc_file..." - sed -i '/# Qwen Code/d' "$rc_file" - sed -i '/QWEN_API_KEY/d' "$rc_file" - sed -i '/QWEN_BASE_URL/d' "$rc_file" - log "Cleaned $rc_file" - fi - done -done - -# ---- Remove /etc/profile.d script ---- - -if [ -f "/etc/profile.d/qwen-code.sh" ]; then - info "Removing /etc/profile.d/qwen-code.sh..." - rm -f "/etc/profile.d/qwen-code.sh" - log "Removed /etc/profile.d/qwen-code.sh" -fi - -# ---- Remove env vars from /etc/environment ---- - -if [ -f "/etc/environment" ] && grep -q 'QWEN_API_KEY\|QWEN_BASE_URL' /etc/environment 2>/dev/null; then - info "Cleaning /etc/environment..." - sed -i '/QWEN_API_KEY/d' /etc/environment - sed -i '/QWEN_BASE_URL/d' /etc/environment - log "Cleaned /etc/environment" -fi - -# ---- Remove npm registry config ---- - -info "Removing npm registry config..." -npm config delete @qwen-code:registry 2>/dev/null || true -log "npm registry config removed" - -echo "" -echo -e "${GREEN}${BOLD} Qwen Code fully uninstalled!${RESET}" -echo "" +#!/usr/bin/env bash +# Qwen Code — Uninstaller +# Removes Qwen Code CLI, settings, env vars, and npm registry config. +# +# Usage: sudo bash uqwen_uninstall.sh +set -euo pipefail + +GREEN="\033[92m" +RED="\033[91m" +CYAN="\033[96m" +YELLOW="\033[93m" +BOLD="\033[1m" +RESET="\033[0m" + +log() { echo -e "${GREEN}[+]${RESET} $*"; } +warn() { echo -e "${YELLOW}[~]${RESET} $*"; } +info() { echo -e "${CYAN}[i]${RESET} $*"; } + +OS="$(uname -s)" +IS_MACOS=false +[ "$OS" = "Darwin" ] && IS_MACOS=true + +sedi() { + if $IS_MACOS; then + sed -i '' "$@" + else + sed -i "$@" + fi +} + +if $IS_MACOS; then + SCAN_DIRS="/Users" +else + SCAN_DIRS="/home" +fi + +echo -e "${BOLD}" +echo " +--------------------------------------+" +echo " | Qwen Code — Uninstaller |" +echo " +--------------------------------------+" +echo -e "${RESET}" + +# ---- Uninstall npm package ---- + +if npm list -g @qwen-code/qwen-code &>/dev/null 2>&1; then + info "Removing @qwen-code/qwen-code..." + npm uninstall -g @qwen-code/qwen-code 2>/dev/null || true + log "npm package removed" +else + warn "Qwen Code not found in npm global packages" +fi + +# ---- Remove settings ---- + +for user_home in /root $SCAN_DIRS/*; do + QWEN_DIR="$user_home/.qwen" + if [ -d "$QWEN_DIR" ]; then + info "Removing $QWEN_DIR..." + rm -rf "$QWEN_DIR" + log "Removed $QWEN_DIR" + fi +done + +# ---- Remove env vars from shell rc files ---- + +for user_home in /root $SCAN_DIRS/*; do + for rc_file in "$user_home/.bashrc" "$user_home/.zshrc"; do + if [ -f "$rc_file" ] && grep -q 'QWEN_API_KEY\|QWEN_BASE_URL\|Qwen Code\|Qwen env\|qwen-code-env' "$rc_file" 2>/dev/null; then + info "Cleaning env vars from $rc_file..." + sedi '/# Qwen Code/d' "$rc_file" + sedi '/# Qwen env/d' "$rc_file" + sedi '/qwen-code-env\.sh/d' "$rc_file" + sedi '/QWEN_API_KEY/d' "$rc_file" + sedi '/QWEN_BASE_URL/d' "$rc_file" + log "Cleaned $rc_file" + fi + done +done + +# ---- Remove env files ---- + +for env_file in "/etc/profile.d/qwen-code.sh" "/etc/qwen-code-env.sh"; do + if [ -f "$env_file" ]; then + info "Removing $env_file..." + rm -f "$env_file" + log "Removed $env_file" + fi +done + +# ---- Remove launchctl env vars (macOS) ---- + +if $IS_MACOS; then + launchctl unsetenv QWEN_API_KEY 2>/dev/null || true + launchctl unsetenv QWEN_BASE_URL 2>/dev/null || true + log "launchctl env vars cleared" +fi + +# ---- Remove env vars from /etc/environment (Linux) ---- + +if [ -f "/etc/environment" ] && grep -q 'QWEN_API_KEY\|QWEN_BASE_URL' /etc/environment 2>/dev/null; then + info "Cleaning /etc/environment..." + sedi '/QWEN_API_KEY/d' /etc/environment + sedi '/QWEN_BASE_URL/d' /etc/environment + log "Cleaned /etc/environment" +fi + +# ---- Remove npm registry config ---- + +info "Removing npm registry config..." +npm config delete @qwen-code:registry 2>/dev/null || true +log "npm registry config removed" + +echo "" +echo -e "${GREEN}${BOLD} Qwen Code fully uninstalled!${RESET}" +echo "" diff --git a/qwen/uqwen_update.sh b/qwen/uqwen_update.sh index efd9262..437256e 100644 --- a/qwen/uqwen_update.sh +++ b/qwen/uqwen_update.sh @@ -12,7 +12,23 @@ NPM_SCOPE="@qwen-code" NPM_PACKAGE="@qwen-code/qwen-code" REPO_RAW="https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen" -ENV_FILE="/etc/profile.d/qwen-code.sh" +OS="$(uname -s)" +IS_MACOS=false +[ "$OS" = "Darwin" ] && IS_MACOS=true + +if $IS_MACOS; then + ENV_FILE="/etc/qwen-code-env.sh" +else + ENV_FILE="/etc/profile.d/qwen-code.sh" +fi + +sedi() { + if $IS_MACOS; then + sed -i '' "$@" + else + sed -i "$@" + fi +} GREEN="\033[92m" CYAN="\033[96m" @@ -133,21 +149,47 @@ fi API_KEY=$(python3 -c "import json; print(json.load(open('$TEMP_DIR/qwen_config.json'))['api_key'])") BASE_URL=$(python3 -c "import json; print(json.load(open('$TEMP_DIR/qwen_config.json'))['base_url'])") -ETC_ENV="/etc/environment" -for kv in "QWEN_API_KEY=\"$API_KEY\"" "QWEN_BASE_URL=\"$BASE_URL\""; do - KEY="${kv%%=*}" - if grep -q "^${KEY}=" "$ETC_ENV" 2>/dev/null; then - sed -i "s|^${KEY}=.*|${kv}|" "$ETC_ENV" - else - echo "$kv" >> "$ETC_ENV" - fi -done +if $IS_MACOS; then + launchctl setenv QWEN_API_KEY "$API_KEY" 2>/dev/null || true + launchctl setenv QWEN_BASE_URL "$BASE_URL" 2>/dev/null || true -cat > "$ENV_FILE" << PROF_EOF + cat > "$ENV_FILE" << ENVEOF +export QWEN_API_KEY="$API_KEY" +export QWEN_BASE_URL="$BASE_URL" +ENVEOF + chmod 644 "$ENV_FILE" + + REAL_HOME="$HOME" + if [ -n "${SUDO_USER:-}" ] && [ "$SUDO_USER" != "root" ]; then + REAL_HOME=$(eval echo "~$SUDO_USER") + fi + for rc_file in "$REAL_HOME/.zshrc" "$REAL_HOME/.bashrc"; do + if [ -f "$rc_file" ] || [ "$rc_file" = "$REAL_HOME/.zshrc" ]; then + if [ -f "$rc_file" ]; then + sedi '/# Qwen env/d' "$rc_file" + sedi '/qwen-code-env\.sh/d' "$rc_file" + fi + echo "[ -f $ENV_FILE ] && . $ENV_FILE # Qwen env" >> "$rc_file" + fi + done +else + ETC_ENV="/etc/environment" + for kv in "QWEN_API_KEY=\"$API_KEY\"" "QWEN_BASE_URL=\"$BASE_URL\""; do + KEY="${kv%%=*}" + if grep -q "^${KEY}=" "$ETC_ENV" 2>/dev/null; then + sedi "s|^${KEY}=.*|${kv}|" "$ETC_ENV" + else + echo "$kv" >> "$ETC_ENV" + fi + done + + mkdir -p /etc/profile.d + cat > "$ENV_FILE" << PROF_EOF export QWEN_API_KEY="$API_KEY" export QWEN_BASE_URL="$BASE_URL" PROF_EOF -chmod 644 "$ENV_FILE" + chmod 644 "$ENV_FILE" +fi # ---- Create wrapper (auto-loads env) ----